Setting up Database mail using gmail account

  • sayfrend

    SSCommitted

    Points: 1733

    Vampire (4/7/2009)


    Hello @sayfrend,

    I used those instructions and configured Gmail...however, when i tried sending a test mail,it failed.

    Below is the DBMail log entry:

    Message:

    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 4 (2009-04-07T12:23:31). Exception Message: Could not connect to mail server. (No such host is known).

    )

    I have also created an exception in my firewall: TCP 587 and restarted my sql server..still no use.

    Can you or some one please let me know about this error?

    Thanks,

    [font="Comic Sans MS"]Vampire[/font]

    Procedure I mentioned works perfectly fine, tested by me, Try disabling your windows fire wall and then test again ?

    Also did you restart SQL Server Agent ?

    Make Sure you are using correct profile. If you ever created profiles before, while testing database mail, default profile will be selected. You have to select correct profile.

  • sayfrend

    SSCommitted

    Points: 1733

    Vampire (4/7/2009)


    Hello @sayfrend,

    I used those instructions and configured Gmail...however, when i tried sending a test mail,it failed.

    Below is the DBMail log entry:

    Message:

    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 4 (2009-04-07T12:23:31). Exception Message: Could not connect to mail server. (No such host is known).

    )

    I have also created an exception in my firewall: TCP 587 and restarted my sql server..still no use.

    Can you or some one please let me know about this error?

    Thanks,

    [font="Comic Sans MS"]Vampire[/font]

    Procedure I mentioned worked perfectly fine, tested by me, Try disabling your windows fire wall and then test again ?

    Also did you restart SQL Server Agent ?

  • Lonely Rogue

    SSCrazy

    Points: 2578

    @sayfrend

    I disabled the firewall and restarted SQL Agent also..but of no use.

    The ping results of Smtp.Gmail.Com is pasted below:

    ping Smtp.Gmail.Com

    Pinging gmail-smtp-msa.l.google.com [209.85.147.109] with 32 bytes of data:

    Request timed out.

    Request timed out.

    Request timed out.

    Request timed out.

    Ping statistics for 209.85.147.109:

    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

    The DBMail Log still shows the same:

    Date 4/8/2009 10:50:19 AM

    Log Database Mail (Database Mail Log)

    Log ID 659

    Process ID 3564

    Mail Item ID 340

    Last Modified 4/8/2009 10:50:19 AM

    Last Modified By sa

    Message

    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 4 (2009-04-08T10:50:18). Exception Message: Could not connect to mail server. (No such host is known).)

    Any further help..please??

    Regards,

    [font="Comic Sans MS"]Vampire[/font]

    --In 'thoughts'...
    Lonely Rogue

  • tcnolan

    SSCrazy

    Points: 2097

    It looks like something is still blocking your traffic. Google does not block ICMP to SMTP.GMAIL.COM so you should be getting a response back from that server. The name you are given is the same one I get when I ping as well: gmail-smtp-msa.l.google.com which responds fine for me.

    [edit]You do get different IP resolution than me, but this is normal. A quick lookup of that 209 address, owned by google, implies that you are located on the west coast possibly in washington or california because the distribution network routes you to the closest google server available.[/edit]

    While it looks like this is still related to a networking issue, could you possibly post the results of the following query? Just remove your mail address from the appropriate columns.

    SELECT * FROM [msdb].[dbo].[sysmail_server]

    [edit #2]Also just to show what I am talking about with ICMP not being filtered... pinging the same host you used gives me a fine set of replies. This implies networking issues.

    Z:\>ping 209.85.147.109

    Pinging 209.85.147.109 with 32 bytes of data:

    Reply from 209.85.147.109: bytes=32 time=93ms TTL=237

    Reply from 209.85.147.109: bytes=32 time=98ms TTL=237

    Reply from 209.85.147.109: bytes=32 time=90ms TTL=237

    Reply from 209.85.147.109: bytes=32 time=88ms TTL=237

    Ping statistics for 209.85.147.109:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

    Approximate round trip times in milli-seconds:

    Minimum = 88ms, Maximum = 98ms, Average = 92ms

    [/edit #2]

  • tcnolan

    SSCrazy

    Points: 2097

    Final thought... make sure your anti-virus software is not blocking port 25 from going out. Any mail filtering configured in AV might interfere with this functionality. Symantec, AVG, and NOD32 can all cause this problem.

  • Lonely Rogue

    SSCrazy

    Points: 2578

    @tnolan

    Below is the output of the query:

    Sorry that i couldn't post the query results as a grid, but i did my best to ensure its readability.

    account_id servertype servername port username credential_id use_default_credentials enable_ssl flags last_mod_datetime

    4 SMTP Smtp.Gmail.Com 587 XXX@Gmail.com 65543 0 1 0 4/8/2009 10:47

    I have disabled my AV; Firewall and tried both sending out the test mail and pinging the Smtp.Gmail.Com...both yielded the same previous results.

    Out of my curiosity, I would like to know, If there is any problem existing in my network that is preventing me from connecting to Smtp.gmail.com.. how was the smtp name resolved to a IP address ?

    --In 'thoughts'...
    Lonely Rogue

  • tcnolan

    SSCrazy

    Points: 2097

    Vampire (4/8/2009)


    @tnolan

    Below is the output of the query:

    Sorry that i couldn't post the query results as a grid, but i did my best to ensure its readability.

    account_id servertype servername port username credential_id use_default_credentials enable_ssl flags last_mod_datetime

    4 SMTP Smtp.Gmail.Com 587 XXX@Gmail.com 65543 0 1 0 4/8/2009 10:47

    I have disabled my AV; Firewall and tried both sending out the test mail and pinging the Smtp.Gmail.Com...both yielded the same previous results.

    Out of my curiosity, I would like to know, If there is any problem existing in my network that is preventing me from connecting to Smtp.gmail.com.. how was the smtp name resolved to a IP address ?

    those smtp settings look correct. the name resolution is standard dns resolution. i havent checked too much into how google has this setup, but its the same concept as how sourceforge tells you the closest download server to get projects from. if you want to investigate you can run nslookup from command line for more info.

    the issue remains however that something is filtering your network traffic. you should get replies from ping to that server.

  • tcnolan

    SSCrazy

    Points: 2097

    You could try using the Microsoft Network Monitor to check if the connections are being opened from SQL, if traffic is getting out and not getting back, etc.

    http://www.microsoft.com/downloads/details.aspx?familyid=f4db40af-1e08-4a21-a26b-ec2f4dc4190d&displaylang=en - Download

    http://support.microsoft.com/kb/148942 - How to KB article

    http://blogs.technet.com/netmon/ - Netmon Team Blog

  • sayfrend

    SSCommitted

    Points: 1733

    Looks like there is some problem with your Machine. You should be able to ping smtp.gmail.com

    Is it a server (Company Machine) or just a test box at home ?

    If it is a server, contact your network team, I faced same issue while configuring database mail at my company. I then requested my Securty team to unblock port 25 and then asked my Notes team to add my server name in smtp server list.

    If it is a Test box, try SQLMail using Outlook. If outlook does not works they definitely Database Mail wont work.

    Also Check if is_broker_enabled = 1 for msdb.

    select name,

    is_broker_enabled

    from sys.databases

    Database Mail uses this feature.

    You said you have disabled Firewall and AV while testing ? So ports blocking should not be an issue.

    I still wonder why you are not able to ping smtp.gmail.com ?

    ~ IM.

  • Lonely Rogue

    SSCrazy

    Points: 2578

    @sayfrend,

    1) I have checked and Broker Service is enabled for my MSDB,

    2) About Port 25 :let me put a fact here.. I have other mail profiles configured through which I send out DBMails..so, in general, for mails these to work..my 25 Port should have been open. However, please let me know how to check if the port is open on my machine.

    3) Reg your question about my machine: The machine on which i configured GMail Smtp is a office machine.

    Any insights / help ..please..bcoz, am really curious(infact anxious) to know why am i not able to configure when it tested successfully by others??

    Thanks a Lot,

    [font="Comic Sans MS"]Vampire[/font]

    --In 'thoughts'...
    Lonely Rogue

  • tcnolan

    SSCrazy

    Points: 2097

    Vampire (4/9/2009)


    @Sayfrend,

    1) I have checked and Broker Service is enabled for my MSDB,

    2) About Port 25 :let me put a fact here.. I have other mail profiles configured through which I send out DBMails..so, in general, for mails these to work..my 25 Port should have been open. However, please let me know how to check if the port is open on my machine.

    3) Reg your question about my machine: The machine on which i configured GMail Smtp is a office machine.

    Any insights / help ..please..bcoz, am really curious(infact anxious) to know why am i not able to configure when it tested successfully by others??

    Thanks a Lot,

    [font="Comic Sans MS"]Vampire[/font]

    tnolan (4/8/2009)


    You could try using the Microsoft Network Monitor to check if the connections are being opened from SQL, if traffic is getting out and not getting back, etc.

    http://www.microsoft.com/downloads/details.aspx?familyid=f4db40af-1e08-4a21-a26b-ec2f4dc4190d&displaylang=en - Download

    http://support.microsoft.com/kb/148942 - How to KB article

    http://blogs.technet.com/netmon/ - Netmon Team Blog

    Try the tools that I mentioned in my previous reply to you and you will easily be able to see if traffic on port 25, 465, 587, or any other port that you like are getting through. If you are unable to figure out network monitor then you might want to contact your network team like sayfrend yas mentioned. All you need to add is a filter in network monitor saying TCP.Port == 587

  • auac243374

    SSC Journeyman

    Points: 98

    Thank you soooo much .It was really helpful for me.

  • - Win

    Hall of Fame

    Points: 3006

    Dear All,

    Me tooo having the same issue....

    Message

    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2009-05-08T14:12:29). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. m28sm2949862poh.24).

    )

    I got the above error when i tried the same......

    Cheers,
    - Win
    "Dont Judge a Book by its Cover"

  • tcnolan

    SSCrazy

    Points: 2097

    SQL-KV (5/8/2009)


    Dear All,

    Me tooo having the same issue....

    Message

    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2009-05-08T14:12:29). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. m28sm2949862poh.24).

    )

    I got the above error when i tried the same......

    If you read the thread you will see that the answer to your problem has been posted a few times.

    See below. The key part you are missing is the "require secure connections checked"

    tnolan (4/6/2009)


    Try this...

    Use smtp.gmail.com for the server

    Change port to 465

    Require secure connections checked

    Basic authentication with your gmail username and password (make sure you use the full email address for username with @gmail.com at the end)

    If that doesn't work, you could try installing IIS locally on your machine and run an SMTP server. Allow relay only for localhost and you should be able to use that for the server in database mail without an issue. Just make sure there isn't a firewall blocking the traffic outbound. It's an easy thing to try and it will probably work.

  • dvendelin

    Valued Member

    Points: 57

    Thanks, this corrected the issue for me.

    (just re-entered my valid passwd for the gmail account)

    🙂

Viewing 15 posts - 16 through 30 (of 50 total)

You must be logged in to reply to this topic. Login to reply