Database mail trouble shooting initial setup

  • I've recently setup database mail, I can send a test email and I receive these ok but I cannot send a 'real' email by script. I am getting a sent status as 'sent' as per example below.

    Any ideas on how to troubleshoot this?

    This query:

    EXEC msdb.dbo.sp_send_dbmail

    @recipients=N'myemail@mydomain.com',

    @body='Message Body',

    @subject ='Message Subject automated test',

    @profile_name ='mailtest',

    @file_attachments ='C:\FileAttachment.txt';

    Followed by this query a minute later

    SELECTmailitem_id, subject,file_attachments,sent_status, sent_date

    FROM msdb.dbo.sysmail_allitems;

    Returns:

    16 Message Subject automated testC:\FileAttachment.txt sent 2010-08-02 11:32:27.000

  • Did you try sending the message to yourself without the attachments?

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • Yes, the same result occurs with or without the attachment.

  • EXEC msdb.dbo.sp_send_dbmail

    @recipients=N'myemail@mydomain.com',

    @body='Message Body',

    @subject ='Message Subject automated test',

    @profile_name ='mailtest',

    @file_attachments ='C:\FileAttachment.txt';

    What is the output after executing the above query? Do you see any error messages?

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • Adiga (8/1/2010)


    EXEC msdb.dbo.sp_send_dbmail

    @recipients=N'myemail@mydomain.com',

    @body='Message Body',

    @subject ='Message Subject automated test',

    @profile_name ='mailtest',

    @file_attachments ='C:\FileAttachment.txt';

    What is the output after executing the above query? Do you see any error messages?

    The query executes successfully and results in 'Mail queued.' in the messages pane.

    In case it helps if I run this statement 'sysmail_help_queue_sp @queue_type = 'Mail' ;' against the msdb i get the following in the results pane:

    mail0RECEIVES_OCCURRING2010-08-02 05:59:41.8872010-08-02 05:59:34.870'

  • Check the database log

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • does your service account have the authorities to read the attached file(s) ?

    edit: yes, or it should have provided the error:

    Msg 22051, Level 16, State 1, Line 0

    Attachment file <filename> is invalid.

    Is there any filtering occuring at your mail server ?

    (attachment content rules, ...)

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Is service broker enabled?

    See http://msdn.microsoft.com/en-us/library/ms189959.aspx for more info.

Viewing 8 posts - 1 through 7 (of 7 total)

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