I configured my server to send SMTP (Gmail) via PHP using this tutorial. https://www.digitalocean.com/community/tutorials/how-to-use-gmail-or-yahoo-with-php-mail-function.
“For Gmail, use the following settings: account gmail tls on tls_certcheck off auth on host smtp.gmail.com port 587 user firstname.lastname@example.org from email@example.com password yourgmailPassw0rd This file can also have more than one account, just ensure that the “account” value is unique for each section. Save the file and use chmod to make this file readable only by the owner since it contains passwords. This step is mandatory because msmtp won’t run if the permissions are more than 600.”
It says this file can have more than one account so I have SMTP connections for 2 websites in the file. Both have a unique name and are configured to send with a custom from address (Gmail is able to send mail as these addresses, both have been tested). My problem is the server has one php.ini file where sendmail_path has a -a ACCOUNT1 flag. How can I configure sendmail_path to send from whichever account in my MSMTPRC file the from address belongs to?
Thank you for any advice.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.