EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #08286


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

Re: [EP-tech] SMTP settings - one solution


Hi Ravi,

As there is so many different ways that mail sending could be configured, my general advice  is to leave this to an application that knows what its doing and configure Postfix to do this for you rather than doing a lot of hacking around with the EPrints code.  Here is a guide for doing this with Amazon SES:

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/postfix.html

There might be the need to make a small change to SystemSettings.pm but I hope even this should not be necessary as your server (i.e. 127.0.0.1) will still be sending email it will just be using Amazon SES as a relay host.

Regards

David Newman

On 05/08/2020 06:17, Ravi M via Eprints-tech wrote:
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

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/

Virus-free. www.avg.com