Send mail using SMTP in php & why not simple mail function.

This blog will explain you how to send using SMTP config and not using old way of simple function to send emails.

It is always recommended to use SMTP authentication for sending emails instead mail function. PHP support mail() function for sending mails. And in general we use it as it fast and easy to do it. When we use mail(), a native function of PHP it goes to Spam box and not in inbox of the intended recipient. So never use mail() function of php it will send your mail to junk only. Instead use SMTP php mailer function.

For the purpose we recommend you to use PHPMailer package to send mails from script.

For SMTP auth credentials you have to look into your cpanel in Email accounts sections where you need to create (if exists skip) account for sending automated mails, then register that email in registered email accounts after use ssl typed connections credentials in PHPMailer config params, after that you will be able to send mails from script. đź™‚

Leave a Reply

Your email address will not be published. Required fields are marked *