Avatar of musalman
musalman
Flag for Oman asked on

SQL Server - Email Fails

Dear All

I have created a New SP that is iterating (Cursor) a Project table and extracting the list of Email address, then sending the specific data to all the Project Email address.

This SP is scheduled in one of the Job to run on every Sunday morning while no other process is going on.

While Email are triggering, But not for all projects. What I mean is that out of 10 valid projects, 1 or two triggers and deliver to recipients but for all other fails.

I checked the Log File and observed the Error :
the mail could not be sent to the recipients because of the mail server failure. cannot send mails to mail server. (failure sending mail.).

Please suggest how may I fix the issue,

according to my analysis and doubt, it looks like that due to Looping, the mail server may gets exhausted, resulting in failure. If this is the case, how may I delay the Loop process OR how may I increase the time delay?

regards
Microsoft SQL Server

Avatar of undefined
Last Comment
musalman

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Barry Cunney

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ste5an

How many mails are sent per execution?

This seems to be primarily a mail server failure, thus you should take a look at the mail server logs.
musalman

ASKER
ste5an:
There are 3-7 email addresses per execution, so where ever less, might be getting success!

Barry Cunney:
I will first use the delay methof for 10 - 20 sec, if this works, then nothing to check, If still it misbehaves, I need to look into the logs,

However, I am not sure how to check the logs further in detail ...

Regards
musalman

ASKER
Barry Cunney: :

After adding a Delay of 20 sec, it seems that all the Email status is appearing as Sent in the sysmail_allitems table.

Tomorrow. I will check with the recipients, and will revert back for any comments.

Thanks for the support.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ste5an

Sounds like an anti-spam delay on your mail server. Check the configuration, whether you can disable it for you SQL Servers IP.
musalman

ASKER
Thanks. Time delay worked !