PHP mail on OctoberCMS 3

Hi! I’m trying to migrate a website from v2 to v3, I usually use the PHP mail option in Settings → Mail Configuration, but on v3 I don’t see it anymore, I just see the API’s, Sendmail, SMTP, etc.

I use Magic Forms to create contact and booking forms, and I can’t seem to get it done.
I’m not an expert, so I’ll appreciate any help!

Thanks in advance!

Hi @EMAD08

To send mail the same as mail() PHP function, you should configure the mailer in the following way:

MAIL_MAILER=sendmail

The host, user, password, port and encryption are not needed. At this point, you may check if it already works, but sometimes this next step is also needed.

Check the .env value in config/mail.php:

'sendmail' => env('MAIL_SENDMAIL', '/usr/sbin/sendmail -bs')

Set the sendmail path in .env. You can check sendmail_path at phpinfo(), but it’s usually this one.

MAIL_SENDMAIL='/usr/sbin/sendmail -t -i'
1 Like

What for are backend mail settings? OC 3 doesnt respect them and i have to set mail settings in .env file.

The backend settings should work

I tested on one more project

  • Update OC 2 to oc 3
  • Test sending emails from system/mailtemplates doesnt work
  • double check and save mail settings in system/settings/update/october/system/mail_settings as smtp server type - doesnt work
  • delete default mail settings in .env file - doesnt work
  • set mail settings in .env file works
  • set wrong settings in system/settings/update/october/system/mail_settings still works

Hey @mkinternet

It would be a big problem if this feature isn’t working, every customer would tell us about it!

To help with your troubleshooting, open the modules/system/ServiceProvider.php file and take a look at the extendMailerService method. Check that the following code is running:

if (MailSetting::isConfigured()) {
    MailSetting::applyConfigValues();
}

You should be able to trace it from there.

I hope this helps!