Why won’t my PHP app send mail? Updated on December 6, 2022 by Carrie Smaha 0 Minutes, 53 Seconds to Read To comply with current SPAM standards involved with the PHP ‘nobody’ user, our newer servers that run PHP under Apache do not allow PHP to send mail via the mail() function, which is the default for most software. In order for you to be able to send mail you’ll need to configure the software to use SMTP with authentication, similar to how a mail client is set up. Most pre-bundled software packages like Joomla, phpBB, and other CMS’s have an option or plugin that will allow you to use SMTP instead of mail() or sendmail. Custom mailing scripts can usually be programmed to use SMTP using PEAR or the popular phpMailer class: https://github.com/PHPMailer/PHPMailer For a phpMailer tutorial, please see this guide: Using phpMailer to Send Mail through PHP To use SMTP you will need to use a valid email address that you’ve created in your cPanel. Most software will ask for these settings: Hostname: localhost OR mail.example.com Authentication: Yes Username: [email protected] Password: Your email password Port: 25 / No SSL or Port 465 / SSL Share this Article Carrie Smaha Senior Manager Marketing Operations Carrie enjoys working on demand generation and product marketing projects that tap into multi-touch campaign design, technical SEO, content marketing, software design, and business operations. More Articles by Carrie Related Articles How to Import Email Accounts and Forwarders into cPanel How to Configure Mailbox Quota Notifications How to Login to SquirrelMail SpamAssassin: Fighting Spam How to Fix the “550 No Such User Here” Email Error How to Setup an Email AutoResponder in cPanel Logging into Horde How to Change an Email Password in cPanel and Webmail How to Purchase InMotion Hosting Professional Email in AMP What is MailChannels and How it Benefits You
I cannot get SMTP authentication to work. Does the user name and password used to authenticate need to match the sender’s address?
Hello Len – SMTP authentication is based on each account sending email out. So, yes, the credentials must match the sender’s email address.