sp_send_dbmail does not work properly

  • hi all,

    i've made a stored procedure that uses sp_send_dbmail to send mails

    no error messages are displayed when executing this stored procedure and the message "mail queued" is displayed but nothing is recieved

    here is the code of the stored procedure

    EXEC msdb.dbo.sp_send_dbmail

    @profile_name = 'Exams',

    @recipients = 'mail@domain.com',

    @Body_format = 'HTML' ,

    @subject = 'test mail' ,

    @body='This is a test';

  • - did you test the mail profile ?

    - can you find any messages in the mail system's logging ?

    - can you send "non-html" text messages ?

    I've used this code to test my dbmail

    declare @subject varchar(1000)

    set @subject = @@servername + ': Count of master sysfiles'

    EXEC msdb.dbo.sp_send_dbmail

    @profile_name = 'SMTP_DBA',

    @recipients = 'mymailaddress@mydomain.com',

    @query = 'SELECT * FROM master.sys.sysfiles ',

    @subject = @subject,

    @body='kind regards',

    @query_result_width = 8000,

    @query_result_separator = '',

    @attach_query_result_as_file = 1 ,

    @query_attachment_filename='deQueryResultFileName.csv',

    @append_query_error = 1 ;

    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

  • -I tried the mail mail profile using send test mail and the mail was recieved

    -I checked the database mail log and the following message appeared

    "the mail could not be recieved by the recepients because of mailserver failure (Sending Mail using Account 4 (2008-01-21T13:33:26). Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.7.1 Message rejected due to content restrictions)"

  • - can you double check the recipient's email address ? ( possible typo )

    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

  • "Message rejected due to content restrictions"

    This is a small clue which indicates why the message isn't being received 😀

    --------------------
    Colt 45 - the original point and click interface

  • - the recipient address is correct

    - i tried a text message type (instead of HTML)

    - the message does not contain anything that may be restricted it is only text

  • So the message might be text, what about any disclaimers, etc... that may be added to the outbound email?

    I had one client that had similar problems sending plain text emails from SQL Server and it turned out to be the disclaimer had a couple of sales pitches in it that mentioned saving $$'s.

    Check with the IT people at the destination and they should be able to check the inbound rules to determine why the email didn't pass the content check.

    --------------------
    Colt 45 - the original point and click interface

  • i do not know what is meant by "inbound" and "outbound" email??????

  • "Inbound" would be when mail is arriving at the mail server, "Outbound" would be when mail is leaving the mail server.

    --------------------
    Colt 45 - the original point and click interface

  • hi guys,

    did you figured out the problem?, i am also getting same problem...

  • Do you receive the same "... content restriction ..." message?

    --------------------
    Colt 45 - the original point and click interface

  • I was having an issue where when I added the parameter @attach_query_result_as_file = 1 I couldn't the mails weren't being sent. I couldn't figure it out and was begining to think I'd gone mad.

    I then noticed that my junk mail folder had increased in size by about 20 mails....

    Yes you guessed it, the mails were been sent to the junk mail folder...

Viewing 12 posts - 1 through 11 (of 11 total)

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