Sql Mail Problem

  • When i exeute the following statement,

    EXEC

    msdb.dbo.sp_send_dbmail

    @recipients = 'vmsbalaji@gmail.com' ,

    @subject = 'TEST' ,@body = 'TEST'

    i am getting error as "mail queued".

    can u help me to resolve the issue.

  • Can you please write the error number and the full message.

    Basit Ali Farooq
    MCITP Database Administrator
    Microsoft Certified Professional Developer (Web Applications)
    Microsoft Certified Database Administrator
    Microsoft Certified Systems Engineer
    Microsoft Certified Systems Administrator
    CIW Security Analyst
    Cisco Certified Network Associate

  • That is not an error, it is a message. You will get this message when a mail message is successfully sent to the service broker. In database mail, messages are not sent when you call the procedure. They are sent to a service broker queue and the queue is processed as quickly as possible as messages come in. This makes sending mail an asynchronous process.

    If the mail is not actually being sent, check the message queue to make sure the broker queue is being processed. If the queue has been processed, check the logs on your SMTP server.

  • can you please explain me how to check the message queue and check the logs on your SMTP server.

    Thanks for any help.

  • you can contact your email server administrator to see why the email is not getting delicvered to the recipient address. If you have an internal email address try that; there can be blocks for external mails. The message you see is not an error; I dont think there is any problem in the db_mail side. See if the post can be of some help -

    http://rajanjohn.blogspot.com/2008/04/using-database-mail-in-sql-server-2005.html

  • The SMTP server logs will depend on the SMTP server you are using. I would suggest you talk to the person who configured the SMTP server.

    The message queue is (like all broker queues) just a table. Look in msdb.dbo.ExternalMailQueue and msbd.dbo.InternalMailQueue. Also, there are a number of tables in msdb starting with sysmail that are related to the messages being sent.

  • In SSMS, right-click on the Database Mail node under Management, and pick View Database Mail Log.

    This will give you a list of recent activity along with possible errors.

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • And if the error found there is : Unable to start mail session (reason: No mail profile defined)"

    Then: In SQL server Management Studio -> SQL Server Agent -> properties -> Alert System -> Enable mail profile. Give SQL Server Agent a restart.

    ------------------------------------------------------------
    Application Architect and Developer @ Traffic4u
    Visit my profile on LinkedIN

  • I also find checking the view "sysmail_allitems" usefull if i am having problems it can aoften highlight something obvious.

  • I have a weird problem here.

    In my first two attempts, the email was delivered successfully, however now it gives me the message

    'Mail queued'

    Any reason, why this should happen?

    I checked the sysmail_allitems and it has entries of the 1st two successes - when the mail was delivered, but no entry for the ones I have been trying now

  • namrata.dhanawade (9/15/2009)


    I have a weird problem here.

    In my first two attempts, the email was delivered successfully, however now it gives me the message

    'Mail queued'

    Any reason, why this should happen?

    I checked the sysmail_allitems and it has entries of the 1st two successes - when the mail was delivered, but no entry for the ones I have been trying now

    Try running the following queries to see if you can get some more info:

    --get failed messages over last 5 days:

    SELECT mailitem_id,* FROM msdb.dbo.sysmail_faileditems

    where datediff (day, sent_date, getdate()) < 5

    --get mailitem_id from query above and run below to get full error message (description column):

    SELECT * FROM msdb.dbo.sysmail_event_log

    where mailitem_id = xxxx

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • I was inserting some test data before executing the SP all in one transaction.

    I tried it without using a rollback and it worked fine!

    Why should an email be queued if it is encapsulated in a transaction?

    and thanks for the help anyway..

  • Hello ali.. how are you mate..

  • Whenever any email is sent through SQL u get a message as "Mail Queued"

    U can also check the sysmail_mailitems table present in the msdb database. Alternatively u can check the Database Mail Logs also.

    Satnam

  • That means the mail was sent successful.

Viewing 15 posts - 1 through 14 (of 14 total)

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