Link to home
Start Free TrialLog in
Avatar of Larry Rungren
Larry RungrenFlag for United States of America

asked on

SP_send_dbmail

I have posed this question once before

Moving from XP_SMTP_SENDMAIL to SP_SEND_DBMAIL.

Not difficult, and test with one or 2 emails OK.

When I try to run several batches of email one works, the next one won't,

Same script, same account date selection is different.

Small batches OK

errors .....
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2012-09-13T13:46:30). Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.1.1 User unknown). )
OR
"The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 2 (2012-09-21T10:56:43). Exception Message: Cannot send mails to mail server. (The operation has timed out.). )"
OR
"The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 2 (2012-09-21T10:56:49). Exception Message: Cannot send mails to mail server. (Failure sending mail.). )"

The IP for the server has no limits on sending mail at the barracuda for either the sending email address or the IP.

I received the following reply and things seemed to run for a short period of time






This is a one time run:

exec msdb.dbo.sysmail_configure_sp 'DatabaseMailExeMinimumLifeTime', '1200';
exec msdb.dbo.sysmail_configure_sp 'AccountRetryAttempts', 3;
1:
2:
Select all
Open in new window


That changes the configuration on the last part of the mail setup

This basically starts up the mail services to be ready to go.
IF NOT EXISTS (SELECT * FROM msdb.sys.service_queues
               WHERE name = N'ExternalMailQueue' AND is_receive_enabled = 1)
BEGIN
    EXEC @rc = msdb.dbo.sysmail_start_sp
END
1:
2:
3:
4:
5:
Select all
Open in new window


And you still may get failures.

Can anyone help with this consistently failing never had an issue with third party software.
Avatar of Larry Rungren
Larry Rungren
Flag of United States of America image

ASKER

I take it nobody has any answers to this dilemma.  That being the case does anyone have a third party piece of software that we can use in its place???
It seems that the issue is with the sql server agent.  When I run these scripts interactively they work just fine.
Avatar of EugeneZ
part#1
<Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.1.1 User unknown).  >


"this is a behavior by design. Database mail does not track failed delivery per recipient. We will consider this as a new feature in future release of SQL Server."
http://connect.microsoft.com/SQLServer/feedback/details/369646/database-mail-re-sending-messages
------------------------------------------------------------------------------------
part#2
>issue is with the sql server agent<
what is the issue?
The mail is delivered internally, but no mail gets to the outside recipients.
check with your exchange admin to see the smtp server settings
That be me except we had Exchange installed seven yeas ago, and the company is gone.  Can you you give me any ideas what configs I should look at?
ASKER CERTIFIED SOLUTION
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As we have tested and tested, it seems the issue is with Exchange/Barracuda configuration, have changed the SMTP server and the issues seems to have corrected itself,  I'll wait another week before I make that a declarative statement, but for the last couple of days all is well.