SMTP Emails Sending out Intermittently from application - ssmtp

I'm facing kind of SMTP mail problem sending through the application using coding as below
SmtpClient SMTPServer = new SmtpClient("smtp.office365.com");
SMTPServer.UseDefaultCredentials = false;
SMTPServer.Credentials = new System.Net.NetworkCredential("xxx#xxx.org","xxxxx")
SMTPServer.Port = 587;
SMTPServer.EnableSsl = true;
So been using this method 2 years ago until recently where we face email not able to send out intermittently with error message "Smtp Error: Failure sending mail". There are times where emails could send out with only average 12 emails per day. Plus, the sender email address from the application is active with correct credential login and password.
I checked our Windows 2008 R2 server and tested with our disabled firewall on server. Problem still persists. And there were no patches update to the server as well.
Is there anything to do with authentication type level? Or certain communication protocol conflicts? How do I check further to determine the root of cause? Our firewall already allowed the port 587 to send out.

There could be many issues to check. You say that the application is sending emails as a "client" to an Exchange 365 SMTP server to sent onwards, that's what the example looks like.
Check that Exchange is not rejecting the request. Microsoft can be very picky about application clients connecting directly. Look in the logs.
Check that your email application client uses TLS 1.2 or above. Many SMTP servers will reject requests below that level.
Exchange might be insisting on a STARTTLS for negotiation on credentials, so check if that is the issue.
Check that the application client is whitelisted in MS Exchange 365 if it is rejecting requests.
Check that the user you are connecting as has privilege to accept connections from remote clients. I often lock this down to prevent brute force password attacks.
Normally I would test all this out on the command line first. Get an email client for your OS like:
sendemail-1.56 by Brandon Zehm <caspian#dotconf.net>
Which is very good at initiating a connection to a remote server. Test from your application client email server and see what happens.

Related

IIS SMTP : is it a real SMTP server or does it only relay?

I was trying to understand if the SMTP virtual server in IIS can only relay mails or if it can act as the final SMTP server. All the tutorials I've found on how to configure it always show it acting as a relay.
It can delivery directly mails (SMTP Server) also relay them

Preventing DOS_OUTLOOK_TO_MX SpamAssasin's flag

I have an application hosted in an Amazon EC2 Server that uses e-mail service from a shared web host. I did this to utilize the shared hosting e-mail server and the available e-mail administration tool and webmail interface.
My application uses amazon SES to send e-mail. I just authorized SES to send mails with my domain name (by adding some entries to my dns records and confirming I'm the domain owner), and this is working ok. When I need to send a mail, I connect to SES SMTP server and send it using PHPMailer.
Everything is working ok, except my mails are getting the DOS_OUTLOOK_TO_MX flag in SpamAsssasin's, making it sometimes be classified as spam.
What this flag means? Is there some way to avoid it?
Spamassassin DOS_OUTLOOK_TO_MX rule is fired when two internal flags are set by processed message: __DOS_DIRECT_TO_MX and __ANY_OUTLOOK_MUA.
__DOS_DIRECT_TO_MX flag means that the message was sent directly from sender email client to recipient MTA server. This is usually true for internal mail but can occur in your case when a recipient also uses Amazon SES for mail processing.
__ANY_OUTLOOK_MUA flag means that the message has X-Mailer =~ /^Microsoft (?:Office )?Outlook\b/ header.
Both internal flags are harmless by themselves but their combination leads to DOS_OUTLOOK_TO_MX with high spam score. You need to check X-Mailer header of messages sent with PHPMailer. This header should be set to PHPMailer, not to Microsoft Outlook or something similar.

Laravel 5.2 Mail cannot be sent outside domain

So when I try to send mails with Laravel's mail facade, I can only send within our company domain, when trying to send E-mails to either gmail or outlook, the mail never gets deliviered, but if I use outlook, the mail is delivered instantly.
I have turned everything upside down to figure out what it can be, but I cant find anything that cause this issue, not even a single trace of my app sending "non-internal" mails in the exchange logs.
Our company uses an Exchange 2003 server, I have checked the logs, no trace of (Out of company) mails are there
Im on a 20 hour streak, sorry for any confusion
/Tarre
The issue was that our Exchange SMTP relay didnt have the correct connectors and configuration.
To use exchange with SMTP.
Add a Connector bridge between your Exchange server and the Virtual SMTP server.
Configure "trusted" IP's.
Everything is done in the Exchange Server Management part.

Mail can't be send: Relay access denied

I have two ruby on rails application on different servers. Both are working fine, but one (server 2) can't send any mails.
I got always the 554 5.7.1 : Relay access denied error.
On server 2 I tested the mail communication with the help of telnet and it works, but it doesn't works with the ruby on rails application.
Other application can send mails, too.
The only difference between both systems are the os (Debian 6 (server 1) and RHEL 6 (server 2)) and the ip ranges (10 network (server 2) and 53 network (server 1)).
I think the best way is to use a simple mail application, but I don't know, how to write something like that.
Thanks for any help.
The IP address of your second server is not in the whitelist for that email server, but the first one is.
Unless you're using authenticated SMTP, you will have to add the IP addresses of all your application servers to the whitelist configuration.
Using telnet will only tell you if the port is accepting connections, not if you can actually send email. For that you'll have to perform an actual SMTP transaction.
There are services like Postmark, SendGrid or even my start-up PostageApp which will act as a mail server for you.

trouble sending mail with free smtp

I am trying to send mail from a local iis app using localhost as my smtp server after installing free smtp but I am getting the following error:
Mailbox unavailable. The server response was: Invalid
recipient: 'validAddress'#hotmail.com
Any idea what the problem could be?
it sounds like your free (3rd party) smtp app is not leaving your network and might be trying to see if it has that mailbox itself. Try and see if there is a setting to allow the smtp server to access external connections, etc. What is the name of the free smtp app, btw?
Alternatively, can u use the built in SMTP mail provider, built into iis? do you know how to use that, instead of this 3rd party app.
It looks more like the SMTP service needs to be configured to "Relay" email... Usually this involves telling it what YOUR mail domain is, and then any mail destin for a domain other than it's own will cause it to go out to the world, and try to relay the message to the real server.
But, be careful! This is how spammers exploit email servers. They look for SMTP listeners that will relay for them. You want to make sure yours will only accept relay mail from "localhost", or whatever machine will be connecting to it to do the sending.
A more secure way is to block port 25 inbound at your firewall to this box, so this SMTP server is not visible to the outside world.
Write and test a simple smtp sender in C. It needs 3 minutes with RFC
Use Wireshark to see what comes on the wire between your application and the SMTP server.

Resources