Emails Not Being Sent

I’m encountering an issue with email delivery in OJS 3.3.4. When a user signs up, registration confirmation emails, as well as password change emails, are not being delivered. I found the following error message in logs:

stream_socket_enable_crypto(): Peer certificate' did not match expected’.

default = smtp
smtp = On
smtp_server =
smtp_port = 587
smtp_auth = tls
smtp_username =
smtp_password = ******

Both the Principal Contact and Support Contact email addresses are set to
Testing SMTP with online tools successfully delivers emails.
My site domain where OJS is hosted is not

Despite successful SMTP testing with online tools, emails are not being delivered to users through OJS.
What could be causing this error?

Have you tried the “two-factor authentication” method?
This method seems to be the solution for many people.

Thanks for your response,

I already tried that, but it’s still not working.
Do you think the issue could be because the site domain ( and the email domain ( are different? Any other ideas on what might be causing this?

Given that you’re using to send emails, whether the site is installed on the main domain or a subdomain shouldn’t be an issue. Nonetheless, I suggest examining the PHP error codes for additional troubleshooting.

By the way your OJS version 3.3.x or 3.4?
There is no version 3.3.4

This is the error that I get when email isn’t sent Unable to connect with STARTTLS: stream_socket_enable_crypto(): Peer certificate' did not match expected CN=’.
are you referring to something else?

Yes, I meant 3.4

I will check on my server for 3.4 and let you know.

It worked without any problem on my server.

here is my config email settings:

; Default method to send emails
; Available options: sendmail, smtp, log, phpmailer
default = smtp
; Path to the sendmail, -bs argument is for using SMTP protocol
sendmail_path = "/usr/sbin/sendmail -bs"
; Use SMTP for sending mail instead of mail()
smtp = On
; SMTP server settings
smtp_server =
smtp_port = 587
; Enable SMTP authentication
; Supported smtp_auth: ssl, tls (see PHPMailer SMTPSecure)
smtp_auth = tls
smtp_username =

smtp_password = App Password is a **16-digit passcode not an email password**

Don’t ignore this settings

I received email

Thank you for doing that.

I have the same exact configuration with email 2FA and a 16-digit passcode, except my SMTP username is not a Gmail address; it is an email address. I don’t know if this affects anything.

I changed something:
The domain where OJS is installed is When I use for the SMTP configuration (instead of, the SMTP username is This email is also my principal and support contact.

For temporary emails with less protection, when I sign up users with them, they receive emails from OJS, but Gmail users don’t. Also, the error logs only show PHP deprecated logs and not errors like before, even if the email isn’t received by the Gmail user. Is it because isn’t verified or something? Does this have to do with SPF, DKIM, or other email authentication methods?

Thanks again.

I recommend checking your SPF and DKIM settings to ensure Gmail users receive your emails. These methods help prevent emails from being marked as spam. Additionally, using your primary domain ( is more reliable than using a subdomain (

For more information on Gmail SMTP settings and managing outbound gateway usage, you can refer to this link: Google Support.