EPrints Technical Mailing List Archive

Message: #08284


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] SMTP settings - one solution


In the EPrints mailing list archive there are many queries about how to configure SMTP settings but I couldn't find a clear answer that worked for me. After some trial and error I've managed to get SMTP working for my EPrints site, and I'm sharing the settings here in case it's useful for anyone.

I run EPrints 3.4.2 on an Ubuntu server, and I use Amazon Simple Email Service (SES) for my SMTP. (I am not affiliated to Amazon in any way - I mention this service to indicate that I don't know if the settings I've used will work with another SMTP provider.)

Step 1:
I defined the value of
smtp_server
in the file
/perl_lib/EPrints/SystemSettings.pm

Step 2:
In the file
/usr/share/eprints/perl_lib/EPrints/Email.pm
I replaced the line
my $smtp = Net::SMTP->new( $smtphost );
with the below:

my $smtp = Net::SMTP->new( $smtphost,
Hello => 'eprints_site_domain',
Debug => 1,
);

And I added these two lines:
$smtp->starttls();
$smtp->auth('username','password');

Of course you should change eprints_site_domain, username, password to match your configuration. On Amazon SES my eprints_site_domain is verified, and my SMTP settings are connected to the same email address that is set as EPrints' adminemail. I suppose this helps in getting email from the site delivered without being marked as spam.

I think the $smtp->starttls(); part is especially important. There is some advice out there on using the Net::SMTP::TLS module instead of Net::SMTP, and at first glance it might seem that the former is more recent or advanced. But Net::SMTP could in fact be more reliable as it is a core Perl module.

Cheers,
Ravi Murugesan