We help IT Professionals succeed at work.

Best way to relay emails in PHP ?

Shakthi777 asked
Hi Experts,

Our application deployed on two LINUX virtual machines in Azure. And the application needs to send emails out in some events in it's work flow.

So, the app using PHP standard mailer (actually it's a combination of YiiMailer, SiwftMailer) and we are trying to use Microsoft O365 email account to relay these emails. So far we didn't able to work this out.

What are the other recommended methods for sending emails out ? without going emails SPAM or JUNK at any cost.
Thanks for your time !
Watch Question

Dave BaldwinFixer of Problems
Most Valuable Expert 2014
without going emails SPAM or JUNK at any cost.
That is not at all your choice.  Users, the email recipients, get to choose what is considered spam or junk in their email client.  In fact, the 'legal' definition of spam in the US is 'unwanted email'.  It says nothing about the content, only that the recipient considers it 'unwanted'.

I would suggest PHPMailer which is the most common program after the PHP 'mail()' command.  Except that you are trying to send thru a Microsoft email server and they do not like emails from PHP web sites.  I have tried for years to make that work.  I can send from an email account thru PHP on the web server and then send the same email thru a standard email client and the PHP email will disappear or bounce if you are lucky and the 'regular' email thru a 'regular email client will go thru without problems.


Thanks for the comment, and what would be the recommended email relay software ? Postfix ?
Fixer of Problems
Most Valuable Expert 2014
Postfix or Sendmail would work for most email addresses.  You will always have trouble with Microsoft mail servers like Hotmail or Microsoft O365.  I found that I could send to them by using PHPMailer to connect to a 'standard' email account and send email that way.  The problem then became that a lot of web servers block the ports used for sending email.


thanks !