[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.aws.amazon.com%2Fses%2Flatest%2FDeveloperGuide%2Fpostfix.html&data=01%7C01%7C%7C5b7050aaab2c4f720e6308d839040496%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&sdata=CxKFiwqVmsXre7osqbF9esEKQxnAjl2EX7yxi1CSjXA%3D&reserved=0

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 
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.eprints.org%2Feptech%2Fmaillist.html&amp;data=01%7C01%7C%7C5b7050aaab2c4f720e6308d839040496%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=YQxFS%2F0XcTscMx%2B8t8e%2BXv1tY0T2pTrMAT%2B8s32MP%2BA%3D&amp;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&amp;data=01%7C01%7C%7C5b7050aaab2c4f720e6308d839040496%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=BzUzQ32UjpmBJdBngh8kgW2dLvSxduO0dM4z9hw6GOE%3D&amp;reserved=0>.
>
> Cheers,
> Ravi Murugesan
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7C%7C5b7050aaab2c4f720e6308d839040496%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=bb8bE6%2F4VDwubzGbi8hfL%2BMWgvdKC%2Fq%2BPuip0mkpfYA%3D&amp;reserved=0
> *** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7C%7C5b7050aaab2c4f720e6308d839040496%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=7g8ecAPn2VkLbsKpVOsYd%2B%2B615GPYfd45iuSwwuxPoo%3D&amp;reserved=0


-- 
This email has been checked for viruses by AVG.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avg.com%2F&amp;data=01%7C01%7C%7C5b7050aaab2c4f720e6308d839040496%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=xJGDNPO8%2FzKeGpDEhKX3huofqQYxk07544SB1TGzpog%3D&amp;reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20200805/1d9ccf3c/attachment.html