If the problem is intermittent, it could be a network error. But it is almost certainly because you are sending too many emails and it is throttling your account.
The mail could not be sent to the recipients because of the mail server failure(SQL) using office365
I have executed the following.
EXEC msdb.dbo.sp_send_dbmail @profile_name='Client_Messages',
@from_address= 'Client Automation <******@client-services.com>',
@recipients='******@companynamedomain.com',
@subject='This is a Test mail',
@body='This is a Test mail from Test DB server',@body_format='html';
Getting error. some times it worked ,ie; mail executed successfully. sometime error occurred. The error message is given below.
Message
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 6 (2021-10-23T17:26:05). Exception Message: Could not connect to mail server. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 12.18.126.228:587).
SQL Server | Other
2 answers
Sort by: Most helpful
-
-
YufeiShao-msft 7,146 Reputation points
2021-10-27T06:23:35.52+00:00 Hi @Noufal P ,
your problem seems network related, especially since nothing has changed on the darabase configuration, please check firewalls, DNS, IP configuration
ensure your SMTP server is working
check if you can telnet your SMPT server:https://learn.microsoft.com/en-us/previous-versions/tn-archive/aa995718(v=exchg.65)
You may consider adding the aspnet_wp.exe to the exclusion list for sending email.
Be sure to check if McAfee Antivirus is installed on the server. By default, Access Protection blocks outgoing smtp connections, except for a whitelist of applications. This will result in the "No connection could be made because the target machine actively refused it" error message. Add w3wp.exe tot the whitelist of applications and everything will work fine.-------------
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.