EPrints Technical Mailing List Archive

Message: #07483


< 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


Hmmm... This second case looks like a bug in the code.  Email.pm would better read something like:

110         # If a name contains anything but alphanumeric space separated
111         # content, it needs quotes.
112         foreach my $name (qw( from_name to_name replyto_name ))
113         {
114                 if( defined $p{$name} and $p{$name} =~ /[^a-z0-9 ]/ )
115                 {
116                         $p{$name} = "\"".$p{$name}."\"";
117                 }
118         }

Enjoy,

- Clinton Graham
Systems Developer
University of Pittsburgh | University Library System
412-383-1057



-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.soton.ac.uk> On Behalf Of Francis Jayakanth via Eprints-tech
Sent: Monday, September 10, 2018 1:50 PM
To: eprints-tech@ecs.soton.ac.uk
Subject: 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
*** Options: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailman.ecs.soton.ac.uk%2Fmailman%2Flistinfo%2Feprints-tech&amp;data=02%7C01%7Cctgraham%40pitt.edu%7C839182fe11354a76b09708d617468d34%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636721989132234805&amp;sdata=KUXDcSXtf3ZyAsUNWtYVkovx9OU8apD64Ru18wGfRk8%3D&amp;reserved=0
*** Archive: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=02%7C01%7Cctgraham%40pitt.edu%7C839182fe11354a76b09708d617468d34%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636721989132244809&amp;sdata=XlT6PBAJfPiHDlp1oxehgBH8m0JT4fbCvnPyUX9dkA0%3D&amp;reserved=0
*** EPrints community wiki: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=02%7C01%7Cctgraham%40pitt.edu%7C839182fe11354a76b09708d617468d34%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636721989132244809&amp;sdata=zMlrbviLaz3Vo3cRkaQZmzTTlfNzl%2Ft21IqNEt2Y0o8%3D&amp;reserved=0
*** EPrints developers Forum: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=02%7C01%7Cctgraham%40pitt.edu%7C839182fe11354a76b09708d617468d34%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636721989132244809&amp;sdata=7Vtp9SrfYgqmdUMQbrK%2BVot%2F8gPeXz%2FmEDngCvxowZw%3D&amp;reserved=0