简体   繁体   中英

SQL Server not sending emails to specific email addresses

I'm encountering a very strange error.

I have a script set up as a stored procedure that is run as a job on a database in SQL Server 2014.

The script notifies users under certain conditions.

I know people will want to see the script, but I can assure you that it isn't relevant to the problem. In fact, if I completely forget about the script, and just run the following as a new query, I still have the same problem:

EXEC msdb.dbo.sp_send_dbmail
   @profile_name = 'Our Email Profile',
   @recipients = 'myName@ourCompanysName.com',
   @subject = 'Test',
   @Body = 'test',
   @Body_format='HTML'

Here is my problem:

When I use any @yahoo email as a recipient, the e-mail successfully is queued and delivered.

When I use any @gmail email as a recipient, the e-mail successfully is queued and delivered.

When I use certain internal, (ie, @OurCompanyName ) emails as a recipient, the e-mail is queued, but is never received.

When I queue the database mail queue (using the EXEC sysmail_help_queue_sp @queue_type = 'Mail' command), the email is not there in the queue.

There are no exceptions being thrown anywhere so far as I can find. The logs show the email as being delivered.

The email is not in my junk folder.

When I try sending a test email from my personal email address to my work address, it succeeds, and my work email is not the only email address which is failing.

Some internal company email addresses deliver just fine.

I used to be able to send myself emails through the script just fine. It has worked in the past.

I've read everything I can find related to this problem, but none of it is relevant.

How can I narrow in on this problem? What else can I do to look for clues as to where the email delivery is failing? I work at a behemoth of a company and I and my coworkers do not know who to contact to see if this is somehow a problem with our internal email.

It sounds like something similar I faced with our company's Exchange servers. There's some setting where you need to be authorized to send to a particular account, and either you haven't authenticated at all, or the account you're sending from doesn't have the rights to send to that account.

My Exchange administrators were able to fix it for me by removing the restriction that you had to be authenticated to send to that account. Once that account was set to be able to receive mail from unauthenticated users, my SQL Agent mails delivered successfully.

I had the same issue. Updated the profile email port to 25 and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM