Setting up Database mail using gmail account

  • immadi74

    Valued Member

    Points: 73

    It worked perfeclty fine with port 587 .....Awesome...Thanks Imran

  • lazy writer

    Ten Centuries

    Points: 1126

    Great stuff 🙂

  • The_SQL_DBA


    Points: 10494

    Good post. I was able to configure database mail successfully to my gmail account. But, when I send a message it says 'Message Queued' and I did not receive any emails. Any ideas?


    "Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."

  • - Win.


    Points: 6790

    Just Gone through earlier posts and tried.

    I successfully created DBMail Setup using,

    with basic authentication of my GMail account and password,

    Created a profile using a server name :, port : 587.

    Then I configured a report server 2005 , (generated a report as Transactions and scheduled to subscribe my GMAIL account) for this profile and tried subscribing to my gmail account.

    When i just tried a query through Query Analyzer it shows "Mail Queued". But when i see the DB Mail Log, the error is as:

    Error Log:

    Date 1/12/2010 12:09:07 PM

    Log Database Mail (Database Mail Log)

    Log ID 77

    Process ID 4192

    Mail Item ID 38

    Last Modified 1/12/2010 12:09:07 PM

    Last Modified By sa


    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2010-01-12T12:09:07). Exception Message: Could not connect to mail server. (No such host is known).


    Correct me if am wrong in any areas.

    My criteria is to get a report server report daily to my gmail account using the SMTP of gmail. So that can configure to my local machine with local internet.

    Any suggestions ?

    - Win.

    " Have a great day "

  • - Win.


    Points: 6790

    Can anyone suggest how to work with Report Server - reports using GMAIL (

    - Win.

    " Have a great day "

  • caspersql


    Points: 2233

    tcnolan (4/6/2009)

    Double check your password... if you made a setting change and saved the profile, go back and re-enter the password and save the profile again. ... make sure to re-enter your password when you make the change again, for some reason SSMS only prints two or three stars in the password box, and seemingly recalculates a hash based on some hidden text in there.

    I had the same thing happen to me. I have a 12 or so character password that was redisplayed as only two stars when I went back in to change settings and re-saving made auth fail. Went in and entered my password again and I had success.

    I experienced the same issue and solution. I was stumped because outbound gmail smtp settings were working fine in outlook but not in SQL server 2005. Finally I checked to see if the number of stars that were displayed instead of my password in database mail settings was less than the number of characters in my password like you described and sure enough - they were. So I re-entered the password and it worked.

    Note that I can recreate the problem so this wasn't a case of me getting the password wrong the first time, rather it is a glitch in SSMS. Every time I go back and change a setting in database mail, if I don't re-enter my password before applying the change I get this error message:

    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2010-02-20T18:48:17). 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.5.1 Authentication Required. Learn more at ). )

    Thanks tcnolan!

  • - Win.


    Points: 6790

    Still i have the same issue with my office machine and my PC as well...

    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2010-02-22T11:55:33). Exception Message: Could not connect to mail server. (No such host is known). )

    Tried the same but no use from many days... So i gave up in the last month itself.....


    Use for the server

    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 at the end)________________________________________________________________

    I think something is hitting back in INDIA...

    - Win.

    " Have a great day "

  • Infamous

    Valued Member

    Points: 68

    Well I tried all the above steps.I'm using SQL server 2005 and this is what my version check returns :

    Microsoft SQL Server 2005 - 9.00.1399.06 (X64) Oct 14 2005 00:35:21 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

    Created a Database mail and tested it, sends mail perfectly. But when i create a operator and set it to notify on job completion, it doesn't work. I get the error message :

    The job succeeded. The Job was invoked by User. The last step to run was step 1 (CB Sync). NOTE: Failed to notify 'new_notify' via email.

    [264] An attempt was made to send an email when no email session has been established

    And yes i have tried all the above suggestions , enabled Database mail profile in SQL server agent , restarted my agent million times so far :crying:. But i still keep getting the same message, no matter what port i use (25,465,587).

    Any suggestions would be helpful

  • - Win.


    Points: 6790

    I tested the same steps once again with the Port number : 587.

    It worked like a charm. recieved mails from server.

    Try with port : 587

    - Win.

    " Have a great day "

  • John Racer

    Valued Member

    Points: 52

    Works like a charm! No restart of the agent required when I testing in 2008R2

  • Jeff Moden

    SSC Guru

    Points: 995971

    sayfrend (4/7/2009)

    Try disabling your windows fire wall

    Don't do it for love nor money. 😉

    --Jeff Moden

    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • LutzM

    SSC Guru

    Points: 107049

    Jeff Moden (11/28/2010)

    sayfrend (4/7/2009)

    Try disabling your windows fire wall

    Don't do it for love nor money. 😉

    After more than 18 month the advice is still true... I'm not sure if it's too late though 😉

    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • azad maratha

    Default port

    Points: 1408


    it will not happen unless you have a mail server.coz it has a dedicated IP through which it sends msgs from sql server to whichever mail account.

    i have tried like what u r doing couple of yrs back.didnt work out.

    so setup a mail server.then u r set to go.

    Thanks & Regards


  • KoldCoffee


    Points: 18971

    Still pertinent and very precise instructions. Thank you very much for the time you took. It helped me today.

  • caspersql


    Points: 2233

    The 'set port to 587' (even though Google says this port is for TLS/STARTTLS) and 'reenter your password if you make changes to the dbmail profile' (because SQL forgets what you entered the first time) advice helped me to get this going after trying different things for the last hour or two - thanks folks!

Viewing 15 posts - 31 through 45 (of 50 total)

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