Can't send email on production server.
See original GitHub issueDescribe the bug I tested on local server and used gmail smtp.gmail.com OR company email, it’s worked email send.
But when i release production to customer web server, Email not send and don’t have any error exception.
1) How i can check some service on customer web server are block send email ? 2) I can check the status of the result when send email (complete / failed) ?
Sample on code:
using (var client = new MailKit.Net.Smtp.SmtpClient())
{
await client.ConnectAsync(sSmtp, nPort, false);
// Note: since we don't have an OAuth2 token, disable
// the XOAUTH2 authentication mechanism.
client.AuthenticationMechanisms.Remove("XOAUTH2");
client.AuthenticationMechanisms.Remove("CRAM-MD5");
client.AuthenticationMechanisms.Remove("DIGEST-MD5");
await client.AuthenticateAsync(sTemplateEmailEmailFrom, sAuthenPassword);
try
{
client.Send(message);
System.IO.File.WriteAllText("C:\\Temp\\NoError.txt","Send");
}
catch (SmtpCommandException ex)
{
Console.WriteLine("Error sending message: {0}", ex.Message);
Console.WriteLine("\tStatusCode: {0}", ex.StatusCode);
switch (ex.ErrorCode)
{
case SmtpErrorCode.RecipientNotAccepted:
Console.WriteLine("\tRecipient not accepted: {0}", ex.Mailbox);
break;
case SmtpErrorCode.SenderNotAccepted:
Console.WriteLine("\tSender not accepted: {0}", ex.Mailbox);
break;
case SmtpErrorCode.MessageNotAccepted:
Console.WriteLine("\tMessage not accepted.");
break;
}
}
catch (SmtpProtocolException ex)
{
Console.WriteLine("Protocol error while sending message: {0}", ex.Message);
}
client.Disconnect(true);
System.IO.File.WriteAllText("C:\\Temp\\DiscountTrue.txt", "DiscountTrue");
}
}
Screenshots
I checked on telnet on customer web server
Other information on server:
- OS: Windows Server 2008 R2 Standard SP1
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
I can't send email on production environment
Mails are sent perfectly in others environments except in production environment. Try logging into the production server(s) and attempt to ...
Read more >Email not sending - Things to do to solve sending issues
Issues concerning email sending are pretty common. Discover how to solve them.
Read more >Cannot send emails: How to fix email sending issues
Cannot send emails : How to fix email sending issues · Check your internet connection. · Check your SMTP server details. · Verify...
Read more >Laravel sending mail not working on production server
Hello All, Whenever I try to send mail to a user my app sends mail to the log file even after changing driver...
Read more >Cannot configure SMTP for outgoing mail on production ...
Hi. So Configuring Outgoing Email in local works fine (Windows 10, 64 bits) and we are able to send emails but we have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Don’t use smtp.gmail.com if you don’t know how to get it working.
GMail blocks you from sending mail unless it recognizes your IP address from a previous login via a web browser.
I don’t know all of the details so I can’t help you. You’ll have to do some google searches and figure it out.
for me also it’s not working on the production server, I am using my company mail, and the strange thing is there is no error or exception coming.