EPrints Technical Mailing List Archive

Message: #07482


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

Re: [EP-tech] eprints integration with office365 SMTP


Hi All, I'm happy to inform that, the eprints integration with
smtp.office365.com is working for us now!

There were 2 issues that needed to be resolved for the integration to work:

1. Issue # 1 - SELinux-related

Enabling SELinux to allow httpd to send email, which can be done using
the following command:

 #setsebool  httpd_can_sendmail 1

After executing the above command and thereafter, on clicking  the
'Request a copy' button, Eprints software was no longer giving the
error message,"The system is currently unable to send email ...".

2. Issue # 2 - Email header-related

In the normal course, clicking on the 'Request a copy' button, eprints
system generates 2 emails - one to the email id associated with the
'Request a copy' button, and the other, a confirmatory email, sent to
the person requesting for a copy of the paper.

In our case, both the emails were being generated, but they were not
being delivered to the recipients.

In the smtp.office365.com configuration,
reposervices.library@auto.iisc.ac.in has been authorised to send out
emails for the eprints server, eprints.iisc.ac.in, but it wasn't being
able to do so because smtp.office365.com was complaining that, 'Client
does not have permissions to send as this sender'.

When we looked into the httpd error log file, we noticed that the
emails' 'From:' header was as below:

From: ePrints@IISc <reposervices.library@auto.iisc.ac.in>. Here,
ePrints@IISc is our Archive Name.

Whereas the description for the reposervices.library@auto.iisc.ac.in
is, 'Repo Services Library'

Because of the incorrect 'From:' email header that was being passed on
to the smtp.office365.com, if was complaining that '  Client does not
have permissions to send as this sender'.

When we looked into the Email.pm code, in line # 106, 'archive_name'
is being passed as 'from_name'.

Line # 106, $p{from_name} = $p{session}->phrase( "archive_name" );

We commented line # 106, reloaded the repository, and restarted the
httpd server, behold, everything started working!.

The 'From:' header in the error_log file now reads, From:
<reposervices.library@auto.iisc.ac.in>

So, the $archive_name as the from_name was causing all the trouble.

I take this opportunity to thank Enio Carboni and Lauke Thomas for
suggesting to enable the 'debug' mode in the Email.pm file. Enabling
of 'debug' mode helped us to localise the issue. I also thank all the
other members who had offered useful suggestions to resolve the issue.

Thanks and regards, Francis
On Thu, Aug 30, 2018 at 3:24 PM Francis Jayakanth <fjayakanth@gmail.com> wrote:
>
> Hi, All. I have been trying to integrate our eprints server,
> eprints.iisc.ac.in with the Microsoft SMTP server, smtp.office365.com
> for almost a month now, but haven't been successful. Can someone who
> has done this integration, share his/her experience, please?.
>
> Postfix MTA has been configured on the eprints server. I'm able to
> send and receive emails from the eprints server's command prompt using
> the 'alpine' application. However, when I try to 'Create  Account' or
> try to 'Request a copy', eprints returns following error message:
>
> The system is currently unable to send email. Please try again later.
> If this problem persists, please contact the administrator with
> details.
>
> The corresponding web server error log message is:
>
> [Thu Aug 30 14:34:45.878756 2018] [perl:error] [pid 110861] [client
> 66.249.79.231:40694] EPrints::abort()\n
> Failed to create SMTP connection to smtp.office365.com
> Failed to send mail.
> To: francis@iisc.ac.in <>
> Subject: Request for "Setting up Multilingual Information Repository:
> A case Study with EPrints.org Software"
>
> Our email support team is saying that Postfix is working fine, the
> problem is with the eprints application configuration..
>
> I'm using, eprints-3.3.15 on CentOS Linux release 7.4.1708 (Core)
>
> From the SystemSettings.pm file, a reference is made to the SMTP
> server in the following statement:
>
> 'smtp_server' => 'smtp.office365.com',
>
> Here are my Postfix configurations:
>
> relayhost = [smtp.office365.com]:587
>
> smtp_sasl_auth_enable = yes
> smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd_test
> smtp_sasl_security_options = noanonymous
> smtp_tls_security_level = may
> sender_canonical_maps = regexp:/etc/postfix/sender_canonical_test
>
> Both sasl_password_maps and sender_canonical_maps have been defined in
> the respective files.
>
> A I have already mentioned, email communication using 'alpine' works well.
>
> My question is, are any other changes required for the eprints email
> integration. with smtp.office365.com? If yes, please let me know.
>
> Thanks in advance,
>
> Best regards, Francis