[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[EP-tech] SMTP settings - one solution
- Subject: [EP-tech] SMTP settings - one solution
- From: rm at auroville.org.in (Ravi M)
- Date: Wed, 5 Aug 2020 10:47:12 +0530
- References: <CANw0mjKqJ_V=pY8y_kLwOMfNtcA-5DXAwmRMVX3BtJYMXpC4Cw@mail.gmail.com>
In the EPrints mailing list archive
<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.eprints.org%2Feptech%2Fmaillist.html&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C015b8d8b647746750a7608d838feda3b%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=n2xszf0EOlqGU2HrIewtG4tJ%2FtbFCAuZPu%2BHHHOme18%3D&reserved=0> 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 <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fperldoc.perl.org%2Findex-modules-N.html&data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C015b8d8b647746750a7608d838feda3b%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=eMJ6xLkbbKg%2FpVpMAimt29XfcC3%2FSC744t1LjNDqiS8%3D&reserved=0>.
Cheers,
Ravi Murugesan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20200805/c70d596f/attachment.html