locked
Can't send e-mail using sp_send_dbmail RRS feed

  • Question

  • Hi team,

    I setup (in the same server) SQL Server 2008 R2 and SMTP Service. I've created an account and profile based in local SMPT server and it works fine when I did the "Send Test E-mail" in "Database Mail"

    The problem is when I use the sp_send_dbmail stored procedure, the e-mail is not send, may be the problem is authentication or communication between SMTP Server and sp_send_dbmail? 

    Thanks for your help!

    Cheers - henpat

    Thursday, September 29, 2011 9:35 AM

Answers

  • Hi,

    Here are some suggestions:

    1) Check that when you use the sp_send_mail stored procedure, you get the "Mail queued" message.

    2) Check that you are using the same profile in sp_send_dbmail as in "Send Test E-mail".

    3) Check the unsent mail with 

    SELECT * FROM sysmail_unsentitems.

    4) Check the failed messages with 

    SELECT * FROM sysmail_faileditems.

    Let us know how it goes.

    Cheers,

    Jerome


    BI Consultant, MCP
    Saturday, October 1, 2011 6:39 PM
  • Thanks for all your replies but I have the same problem so, regarding your points:

    1.- After execute the SP the message "Mail queued" appears

    2.- I use the same profile

    3. In sysmail_unsentitems results appears my e-mail taht I didn't receive

    - Sent_Request_Date (today)

    - send_request_user: (My domain account DOMAIN\user)

    - sent_account_id: NULL

    - sent_status: unsent

    - last_mod_date (same date that sent_request_date)

    - last_mod_user (sa)

    4. In sysmail_faileditems: Appear other records taht failed but my unset e-mail is not there, here are failed e-mails from one month ago.

    Just to explain that this occurs just with one SMTP account (the local one) when I use another server SMTP is works but I need use the local SMTP local service, may be some is grown in authentication? I d'ont understant why I can send a test but not execute a SP.

    Again, thanks for your help!

    Cheers

    • Marked as answer by henpat Wednesday, January 23, 2013 9:08 AM
    Thursday, October 6, 2011 10:23 AM

All replies

  • Hi,
    Links may help you.

    1.http://msdn.microsoft.com/en-us/library/ms190307.aspx
    2.http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/

    Shatrughna
    Thursday, September 29, 2011 10:54 AM
  • Have a look at this previous post - http://social.msdn.microsoft.com/Forums/en/sqlkjmanageability/thread/76f7ac56-56c8-471e-9a89-4c75e788ecef

    as well as this post as it seems to fit the same as what you are mentioning. - http://www.sqlservercentral.com/Forums/Topic859690-149-1.aspx#bm859992

    I hope this helps


    Warwick Rudd
    MCT MCITP SQL Server 2008 Admin
    My Blog
    -------------------------------------------------------
    Please mark as Answered if I have answered your question
    Please vote if this was useful
    -------------------------------------------------------
    Thursday, September 29, 2011 11:58 AM
  • You can check SMTP logs for more details

    C:\WINDOWS\system32\LogFiles\SMTPSVC1

    Friday, September 30, 2011 5:42 AM
  • Hi,

    Here are some suggestions:

    1) Check that when you use the sp_send_mail stored procedure, you get the "Mail queued" message.

    2) Check that you are using the same profile in sp_send_dbmail as in "Send Test E-mail".

    3) Check the unsent mail with 

    SELECT * FROM sysmail_unsentitems.

    4) Check the failed messages with 

    SELECT * FROM sysmail_faileditems.

    Let us know how it goes.

    Cheers,

    Jerome


    BI Consultant, MCP
    Saturday, October 1, 2011 6:39 PM
  • Hi henpat,

    For troubleshooting Database Mail issue, I would like to recommend you have a look at the article on OBL: Troubleshooting Database Mail.

    Hope this helps.

    Best Regards,
    Stephanie Lv


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, October 6, 2011 10:16 AM
  • Thanks for all your replies but I have the same problem so, regarding your points:

    1.- After execute the SP the message "Mail queued" appears

    2.- I use the same profile

    3. In sysmail_unsentitems results appears my e-mail taht I didn't receive

    - Sent_Request_Date (today)

    - send_request_user: (My domain account DOMAIN\user)

    - sent_account_id: NULL

    - sent_status: unsent

    - last_mod_date (same date that sent_request_date)

    - last_mod_user (sa)

    4. In sysmail_faileditems: Appear other records taht failed but my unset e-mail is not there, here are failed e-mails from one month ago.

    Just to explain that this occurs just with one SMTP account (the local one) when I use another server SMTP is works but I need use the local SMTP local service, may be some is grown in authentication? I d'ont understant why I can send a test but not execute a SP.

    Again, thanks for your help!

    Cheers

    • Marked as answer by henpat Wednesday, January 23, 2013 9:08 AM
    Thursday, October 6, 2011 10:23 AM
  • Still an issue?

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Wednesday, January 23, 2013 1:49 AM