Sending email from OJS via Amazon SES service

Hello all

I am attempting to configure an OJS install (2.4.6) on an Amazon Web Services EC-2 instance. Everything (that I have tried so far, which is most of the OJS functionality) is working fine, but I do not seem to be able to send emails from within OJS.

I am using Amazon SES service, attempting to use their SMTP interface.
I have followed all the required steps from the AWS side to configure SES. Including obtaining SMTP credentials. I have confirmed the email address that I am attempting to send to (it is my own address), and the commandline AWS SES tool can successfully send to it. I know that I am in the SES sandbox at the moment, but the address should still work.

When it comes to configuring OJS, I have the following in my config.inc.php file

 ; Use SMTP for sending mail instead of mail()
 smtp = On
; SMTP server settings
 smtp_server = email-smtp.us-west-2.amazonaws.com
 smtp_port = 465     {according to AWS documentation, this port for TLS
; Enable SMTP authentication
; Supported mechanisms: tls, ssl
 smtp_auth = tls
 smtp_username = xxxxxx_obfuscated
 smtp_password = xxxxxx_obfuscated

; 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 = my_address@my_host.com
; Force the default envelope sender (if present)
; This is useful if setting up a site-wide noreply address
; The reply-to field will be set with the reply-to or from address.
; force_default_envelope_sender = Off
; Enable attachments in the various "Send Email" pages.
; (Disabling here will not disable attachments on features that
; require them, e.g. attachment-based reviews)
enable_attachments = On

I have also tried port 25 for the SMTP server, and ssl rather than tls for authentication method, with no luck.

Any recommendations on what I may need to do to make this connection work?

(As a side note, the reason I am doing this on AWS is so I can demonstrate functionality to a select group of members of my academic society’s board before we invest in a server/colocation costs. I’m not necessarily planning to leave the journal on AWS, but at the same time would like to have that option. I know that to do that we would need to apply to come out of the AWS sandbox, but at the moment it should be working within the sandbox with the addresses I have verified.)

Thanks in advance

Craig.

Hi @Craig_Ruaux,

Have a look at this example:
https://pkp.sfu.ca/wiki/index.php?title=Using_gmail_SMTP

You might need to use a prefix on your hostname to get SSL and/or TLS working properly.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Craig,

I am thinking about trying this out but wanted to reach out first and you what you got.

Have you managed to get AWS SES working?

thanks!
Luciano

HI @asmecher

I’taken a different approach and have set up my server’s postfix sendmail to use AWS SES and have configured my PHP mail() to use this.

My OJS 3.0.2 config.inc.php has the mail smtp settings commented as to use the PHP mail() function.

I am able to receive messages sent by PHP using the sample script below but OJS messages are not sent…

Can you help me debug this?

<?php
$to = ‘myemail@gmail.com';
$subject = ‘the subject';
$message = ‘hello';
$headers = ‘From: myfrom@email.com’ . “\r\n” .
‘Reply-To: myreplyto@email.com’ . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();
mail($to, $subject, $message, $headers);
?>

thanks!
Luciano

Hi @lpanebr,

Have you checked your mail delivery logs to see whether there’s information there about the messages delivered through OJS?

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks @asmecher for your quick reply.

My setup is actually fine and works like a charm!

It my testing that was the problem…

thanks!
Luciano

1 Like

Broken link
Can you post new link?

[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
smtp_auth = tls
smtp_username = “(removed)”
smtp_password = “(removed)”

; 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 = (removed)
;above verified email on amazon ses

; Enable attachments in the various “Send Email” pages.
; (Disabling here will not disable attachments on features that
; require them, e.g. attachment-based reviews)
enable_attachments = On

; Amount of time required between attempts to send non-editorial emails
; in seconds. This can be used to help prevent email relaying via OJS.
;time_between_emails = 3600

; Maximum number of recipients that can be included in a single email
; (either as To:, Cc:, or Bcc: addresses) for a non-priveleged user
;max_recipients = 4

; If enabled, email addresses must be validated before login is possible.
;require_validation = Off

; Maximum number of days before an unvalidated account expires and is deleted
;validation_timeout = 14

Cant connect
Where’s the error?

I did connect and sent

indent preformatted text by 4 spaces

[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 = 587

; Enable SMTP authentication
smtp_auth = tls
smtp_username = "usuario"
smtp_password = "senha"

; 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 = contato@revistacafecomsociologia.com

; Enable attachments in the various "Send Email" pages.
; (Disabling here will not disable attachments on features that
; require them, e.g. attachment-based reviews)
enable_attachments = On

; Amount of time required between attempts to send non-editorial emails
; in seconds. This can be used to help prevent email relaying via OJS.
;time_between_emails = 3600

; Maximum number of recipients that can be included in a single email
; (either as To:, Cc:, or Bcc: addresses) for a non-priveleged user
;max_recipients = 4

; If enabled, email addresses must be validated before login is possible.
;require_validation = Off

; Maximum number of days before an unvalidated account expires and is deleted
;validation_timeout = 14

; 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

; Default envelope sender to use if none is specified elsewhere
;default_envelope_sender = contato@revistacafecosociologia.com

; Force a DMARC compliant from header (RFC5322.From)
; If any of your users have email addresses in domains not under your control
; you may need to set this to be compliant with DMARC policies published by
; those 3rd party domains.
; Setting this will move the users address into the reply-to field and the
; from field wil be rewritten with the default_envelope_sender.
; To use this you must set force_default_enveloper_sender = On and
; default_envelope_sender must be set to a valid address in a domain you own.
force_dmarc_compliant_from = On

; The display name to use with a DMARC compliant from header
; By default the DMARC compliant from will have an empty name but this can
; be changed by adding a text here.
; You can use '%n' to insert the users name from the original from header
; and '%s' to insert the localized sitename.
dmarc_compliant_from_displayname = '%n via %s'
    indent preformatted text by 4 spaces