locked
sp_send_dbmail fails to deliver the mail to Gmail/Hotmail RRS feed

  • Question

  • Good day all,
    When I used the way "msdb.dbo.sp_send_dbmail" to send mails to the Gmail or hotmail accounts I got delay for more than half a hour. Actually Gmail & hotmail are nearly never delaying any mails. Any ideas?

    I am able to send mails to Gmail from my Outlook mail box.

    The problem is only when I send it in this way to my Gmail account
    USE [FD_schema2];
    GO
    declare @body1 varchar(100)
    set @body1 = 'Server :'+@@servername+ ' I''m testing the email '
    EXEC msdb.dbo.sp_send_dbmail @recipients='mymailbox@gmail.com',
        @subject = 'My Mail Test',
        @body = @body1,
        @body_format = 'HTML',
        @file_attachments='c:\file.txt';

    How can we check that firewall is prohibiting from sending the mail to Gmail?


    Many Thanks & Best Regards, HuaMin Chen
    Wednesday, March 23, 2011 7:10 AM

Answers

  • Check your SMTP logs on the Exchange server, that will tell you why it is being delayed.

    This most likely has nothing to do with DB Mail.

    • Proposed as answer by Peja Tao Monday, April 4, 2011 2:28 AM
    • Marked as answer by Alex Feng (SQL) Monday, April 4, 2011 3:18 AM
    Tuesday, March 29, 2011 1:43 PM

All replies

  • I would first assure that the mail was sent as expected by looking at the mail tables in msdb and then look at the smtp server. The fact that the mail does reach it's destination eventually minimizes the chances that the FW is the issue here since we know that the relevant port is open for outbound traffic.
    -- Yaniv www.sqlserverutilities.com http://blogs.microsoft.co.il/blogs/yaniv_etrogi
    Wednesday, March 23, 2011 7:13 AM
  • Many thanks Yaniv.
    I've tried to send it once again using the above and can see that it's failure again amid this

    SELECT sent_status,* FROM msdb.dbo.sysmail_allitems;


    Many Thanks & Best Regards, HuaMin Chen
    Wednesday, March 23, 2011 7:32 AM
  • It means there is no success from the database right?
    Many Thanks & Best Regards, HuaMin Chen
    Wednesday, March 23, 2011 7:33 AM
  • Did you try this

    http://blogs.msdn.com/b/suhde/archive/2009/07/12/how-to-configure-sql-server-database-mail-to-send-email-using-your-windows-live-mail-account-or-your-gmail-account.aspx


    Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
    --------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------------------------------------------------------------------
    My Blog: http://blogs.msdn.com/blakhani
    Team Blog: http://blogs.msdn.com/sqlserverfaq
    Wednesday, March 23, 2011 8:10 AM
  • Hi,
    Now the problem is, everything is fine for dbmail if I send the mails from the database to the addresses other than Gmail & hotmail ones. I also see the failures mentioned above in the database. Did anyone get this before?

    Many Thanks & Best Regards, HuaMin Chen
    Thursday, March 24, 2011 1:49 AM
  • Hi HuaMin,

    Could you please try to  follow the steps like : open Object Explorer in SSMS , go to Management->Database Mail ->right click and select ‘view Database Mail log’ .
    Is there any error  message logged ?  Please post it if any .

    Hope this helps.


    Best Regards,
    Peja Tao

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Friday, March 25, 2011 8:40 AM
  • Good day Peja,
    I've just tried to resend the mails by dbmail. But within that log of today (see below)
    http://www.4shared.com/photo/83gIRO5c/fig82.html

    I can't see any lines that are with the current time (since right now it's 2:42 PM)


    Many Thanks & Best Regards, HuaMin Chen
    Monday, March 28, 2011 6:44 AM
  • What is the SMTP server your DB Mail is configured for? 

    This is most likely an issue with the SMTP server, not your SQL Server.  What you are describing is almost always a result of the SMTP server being "throttled" because it thinks your server is sending to much SPAM.

     

    Monday, March 28, 2011 6:20 PM
  • Good day Tom,

    I configured the DBmail through exchange server. How can I resolve this in SMTP?


    Many Thanks & Best Regards, HuaMin Chen
    Tuesday, March 29, 2011 1:54 AM
  • Check your SMTP logs on the Exchange server, that will tell you why it is being delayed.

    This most likely has nothing to do with DB Mail.

    • Proposed as answer by Peja Tao Monday, April 4, 2011 2:28 AM
    • Marked as answer by Alex Feng (SQL) Monday, April 4, 2011 3:18 AM
    Tuesday, March 29, 2011 1:43 PM