DebugFactor.com | Forum

How to configure AWS SES in OJS for email notification?

I am hosting OJS v3.3.0-5 and would like to use AWS SES (Simple Email Service) for email notification. I have tried setting it up by configuring config.inc.php, but it seems to be not working. Can you please check if there is anything wrong with my configuration?

[email]

; Use SMTP for sending mail instead of mail()
; smtp = On

; SMTP server settings
smtp_server = email-smtp.us-east-1.amazonaws.com
smtp_port = 25

; Enable SMTP authentication
; Supported smtp_auth: ssl, tls (see PHPMailer SMTPSecure)
; smtp_auth = ssl
smtp_username = <MY_AWS_SES_USERNAME>
smtp_password = <MY_AWS_SES_PASSWORD>
;
; Supported smtp_authtype: RAM-MD5, LOGIN, PLAIN, XOAUTH2 (see PHPMailer AuthType)
; (Leave blank to try them in that order)
; smtp_authtype =

Can you try to install sendmail?

In Ubuntu,

sudo apt-get install sendmail

In RHEL

sudo yum install sendmail

I have installed sendmail, but still I am not able to get the email working. I am seeing the below message in my error.log file after enabling smtp in config.inc.php

[php7:notice] [pid 3432] [client 103.153.105.212:4871] Connection: opening to email-smtp.us-east-1.amazonaws.com:25, timeout=300, options=array(), referer: http://18.234.217.16/index.php/index/login/lostPassword

You need to enable smtp=On by removing the ; from the line.

smtp = On

Thanks, Asha for the reply. I uncommented smtp = On, but still I am not receiving any emails. I am seeing the following error in /var/log/apache/error.log

sh: 1: /usr/sbin/sendmail: not found
[Tue Apr 20 17:23:40.481463 2021] [php7:notice] [pid 1161] [client 103.153.105.212:8479] Could not instantiate mail function., referer: http://34.234.96.103/index.php/index/login/lostPassword

Do I have to enable/verify anything at AWS level?

The correct configuration is

;;;;;;;;;;;;;;;;;;
; Email Settings ;
;;;;;;;;;;;;;;;;;;

[email]

; Use SMTP for sending mail instead of mail()
smtp = On

; SMTP server settings
smtp_server = email-smtp.us-east-1.amazonaws.com
smtp_port = 465

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
smtp_auth = ssl
smtp_username = <YOUR_AWS_SMTP_USERNAME>
smtp_password = <YOUR_AWS_SMTP_PASSWORD>

; Enable suppressing verification of SMTP certificate in PHPMailer
; Note: this is not recommended per PHPMailer documentation
; smtp_suppress_cert_check = On

; Allow envelope sender to be specified
; (may not be possible with some server configurations)
allow_envelope_sender = On

; Default envelope sender to use if none is specified elsewhere
default_envelope_sender = <YOUR_FROM_EMAIL_ADDRESS>

; Force the default envelope sender (if present)
; This is useful if setting up a site-wide no-reply address
; The reply-to field will be set with the reply-to or from address.
force_default_envelope_sender = On

To get the SMTP credentials, login to AWS Management Console and navigate to SES (Simple Email Service) service.