EPrints Technical Mailing List Archive

Message: #07464


< 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 Francis,

 all this means that you can not send email (relay denied) to the domain "iisc.ac.in" using 127.0.0.1 and port 25 with clear protocol (without ssl) and without authentication.
You should check the postfix configuration with your system administrator and evaluate at least what you have in the "smtpd_relay_restrictions" and "mynetworks" variables.
To quickly see the postfix configuration use the "postconf" command

The "mail" program directly uses the "sendmail" program which is part of "postfix" so I'm not sure how it behaves.

Good luck
  Enio


Il 31/08/2018 19:17, Francis Jayakanth ha scritto:
Hi Enio, Thanks for your reply.

The output of execution of the script, smtp_send_test_email.pl, is:

-bash-4.2$ perl smtp_test_send_email.pl

Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>>   Net::Cmd(2.29)
Net::SMTP>>>     Exporter(5.68)
Net::SMTP>>>   IO::Socket::INET(1.33)
Net::SMTP>>>     IO::Socket(1.34)
Net::SMTP>>>       IO::Handle(1.33)
Net::SMTP=GLOB(0xc3dab0)<<< 220 localhost ESMTP Postfix
Net::SMTP=GLOB(0xc3dab0)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0xc3dab0)<<< 250-localhost
Net::SMTP=GLOB(0xc3dab0)<<< 250-PIPELINING
Net::SMTP=GLOB(0xc3dab0)<<< 250-SIZE 10240000
Net::SMTP=GLOB(0xc3dab0)<<< 250-VRFY
Net::SMTP=GLOB(0xc3dab0)<<< 250-ETRN
Net::SMTP=GLOB(0xc3dab0)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0xc3dab0)<<< 250-8BITMIME
Net::SMTP=GLOB(0xc3dab0)<<< 250 DSN
localhost ESMTP Postfix
Net::SMTP=GLOB(0xc3dab0)>>> MAIL FROM:<eprints@iisc.ac.in>
Net::SMTP=GLOB(0xc3dab0)<<< 250 2.1.0 Ok
Net::SMTP=GLOB(0xc3dab0)>>> RCPT TO:<francis@iisc.ac.in>
Net::SMTP=GLOB(0xc3dab0)<<< 454 4.7.1 <francis@iisc.ac.in>: Relay access denied
SMTP refused RCPT TO: <francis@iisc.ac.in>: 454 4.7.1
<francis@iisc.ac.in>: Relay access denied
Net::SMTP=GLOB(0xc3dab0)>>> QUIT
Net::SMTP=GLOB(0xc3dab0)<<< 221 2.0.0 Bye

I tried assigning eprints@eprints.iisc.ac.in and eprints@iisc.ac.in to
the $from variable. For both the values, Relay access is denied.

So, what does 'Relay access denied' indicate? As I have been
mentioning, using 'mail' command, I'm able to send out mails from
eprints.iisc.ac.in.

Thanks and regards, Francis



On Fri, Aug 31, 2018 at 10:07 PM Enio Carboni <enio.carboni@gmail.com> wrote:
Ok, so the connection to postfix is ok then try to send the email with
the new gist
https://gist.github.com/eniocarboni/ea3747c6aa5be32a35f9accd96f23296

Change the variable $from and $to and run the test.

If the mail arrives then the problem is in the configuration of your
"eprint".

  Enio


Il 31/08/2018 15:39, Francis Jayakanth ha scritto:
Thanks for the reply.

Output from test.pl is given below. Unfortunately, it doesn't make
much sense to me!

Net::SMTP>>> Net::SMTP(2.31)
Net::SMTP>>>   Net::Cmd(2.29)
Net::SMTP>>>     Exporter(5.68)
Net::SMTP>>>   IO::Socket::INET(1.33)
Net::SMTP>>>     IO::Socket(1.34)
Net::SMTP>>>       IO::Handle(1.33)
Net::SMTP=GLOB(0xe97800)<<< 220 localhost ESMTP Postfix
Net::SMTP=GLOB(0xe97800)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0xe97800)<<< 250-localhost
Net::SMTP=GLOB(0xe97800)<<< 250-PIPELINING
Net::SMTP=GLOB(0xe97800)<<< 250-SIZE 10240000
Net::SMTP=GLOB(0xe97800)<<< 250-VRFY
Net::SMTP=GLOB(0xe97800)<<< 250-ETRN
Net::SMTP=GLOB(0xe97800)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0xe97800)<<< 250-8BITMIME
Net::SMTP=GLOB(0xe97800)<<< 250 DSN
localhost ESMTP Postfix
Net::SMTP=GLOB(0xe97800)>>> QUIT
Net::SMTP=GLOB(0xe97800)<<< 221 2.0.0 Bye

Best regards, Francis
On Fri, Aug 31, 2018 at 5:44 PM Enio Carboni <enio.carboni@gmail.com> wrote:
Well! Could now you run the test script you find in
https://gist.github.com/eniocarboni/33c12cbee12e54e544117b60e514a5ac

    Enio

Il 31/08/2018 13:47, Francis Jayakanth ha scritto:
Hi Enio, Thanks for the reply. Yes port 25 is open

   netstat -napt | grep 127.0.0.1:25 doesn't find the pattern, but
netstat -napt | grep 0.0.0.0:25 returns the following output:

tcp        0      0 0.0.0.0:25              0.0.0.0:*
LISTEN      106776/smtpd

Also, I'm able to telnet to port 25:

telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 localhost ESMTP Postfix

Best regards, Francis
On Thu, Aug 30, 2018 at 10:49 PM Enio Carboni <enio.carboni@gmail.com> wrote:
Hi Francis,

the problem seem to be in "Failed to create SMTP connection to localhost" found in https://github.com/eprints/eprints/blob/2d42b2be54004bf3db6881a6d893d39c7a7f909f/perl_lib/EPrints/Email.pm#L169

EPrint use "my $smtp = Net::SMTP->new( $smtphost );" on line 166

and defaut to port 25 on "$smtphost" (localhost).

Is your postfix active on this port?

netstat -napt | grep 127.0.0.1:25

   Enio
Il 30/08/2018 17:22, Francis Jayakanth ha scritto:

Hi, Thomas, thank very much for the kind reply.

Yes, I have tried both  'smtp_server' => 'localhost' and 'smtp_server'
=> 'eprints.iisc.ac.in' options, but the outcome is the same.

Here is the corresponding web server log file extract"

Failed to create SMTP connection to localhost
Failed to send mail.
To: francis@iisc.ac.in <>
Subject: Request for "Setting up Multilingual Information Repository:
A case Study with EPrints.org Software"

No helpful hint from the maillog file, too. Here is the extract from
the /var/log/maillog file:

Aug 30 13:13:35 eprints postfix/postfix-script[104689]: starting the
Postfix mail system
Aug 30 13:13:35 eprints postfix/master[104691]: daemon started --
version 2.10.1, configuration /etc/postfix
Aug 30 13:13:35 eprints postfix/pickup[104692]: EE3A2135D797: uid=0 from=<root>
Aug 30 13:13:35 eprints postfix/cleanup[104694]: EE3A2135D797:
message-id=<20180830074335.EE3A2135D797@localhost>
Aug 30 13:13:36 eprints postfix/qmgr[104693]: EE3A2135D797:
from=<eprints@iisc.ac.in>, size=510, nrcpt=1 (queue active)
Aug 30 13:13:36 eprints postfix/local[104696]: EE3A2135D797:
to=<root@localhost.localdomain>, orig_to=<root>, relay=local,
delay=53311, delays=53311/0.02/0/0.01, dsn=2.0.0, status=sent
(delivered to mailbox)
Aug 30 13:13:36 eprints postfix/qmgr[104693]: EE3A2135D797: removed
Aug 30 13:18:32 eprints postfix/postfix-script[105288]: stopping the
Postfix mail system
Aug 30 13:18:32 eprints postfix/master[104691]: terminating on signal 15
Aug 30 13:21:22 eprints postfix/postfix-script[105663]: starting the
Postfix mail system
Aug 30 13:21:22 eprints postfix/master[105665]: daemon started --
version 2.10.1, configuration /etc/postfix
Aug 30 14:19:13 eprints postfix/postfix-script[110740]: stopping the
Postfix mail system
Aug 30 14:19:13 eprints postfix/master[105665]: terminating on signal 15
Aug 30 14:19:13 eprints postfix/postfix-script[110822]: starting the
Postfix mail system
Aug 30 14:19:13 eprints postfix/master[110824]: daemon started --
version 2.10.1, configuration /etc/postfix
Aug 30 19:45:17 eprints postfix/smtpd[5469]: connect from localhost[127.0.0.1]
Aug 30 19:45:17 eprints postfix/smtpd[5469]: 24F61201F8D1:
client=localhost[127.0.0.1]
Aug 30 19:45:17 eprints postfix/smtpd[5469]: disconnect from
localhost[127.0.0.1]
Aug 30 19:45:17 eprints postfix/pickup[2911]: 66ABA135D797: uid=1003
from=<eprints@eprints.iisc.ac.in>
Aug 30 19:45:17 eprints postfix/cleanup[5471]: 66ABA135D797:
message-id=<alpine.LRH.2.21.1808301944160.5342@eprints.iisc.ac.in>
Aug 30 19:45:17 eprints postfix/qmgr[110826]: 66ABA135D797:
from=<eprints@iisc.ac.in>, size=655, nrcpt=1 (queue active)
Aug 30 19:45:19 eprints postfix/smtp[5474]: 66ABA135D797:
to=<fjayakanth@gmail.com>, relay=smtp.office365.com[40.100.141.2]:587,
delay=2.5, delays=0.3/0.04/1.9/0.26, dsn=2.6.0, status=sent (250 2.6.0
<alpine.LRH.2.21.1808301944160.5342@eprints.iisc.ac.in>
[InternalId=35716948034469,
Hostname=MA1PR0101MB1701.INDPRD01.PROD.OUTLOOK.COM] 3726 bytes in
0.227, 16.006 KB/sec Queued mail for delivery)
Aug 30 19:45:19 eprints postfix/qmgr[110826]: 66ABA135D797: removed

The maillog extract indicates that only mails sent using 'alpine' are
being logged.

Thanks and regards, Francis

On Thu, Aug 30, 2018 at 6:24 PM <th.lauke@arcor.de> wrote:

Hi Francis,

'smtp_server' => 'smtp.office365.com'

have you tried
'smtp_server' => 'localhost'
instead?

Are there any helpful messages in /var/log/exim4/mainlog?

Hth
Thomas

*** 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/
*** EPrints developers Forum: http://forum.eprints.org/


*** 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/
*** EPrints developers Forum: http://forum.eprints.org/
*** 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/
*** EPrints developers Forum: http://forum.eprints.org/
*** 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/
*** EPrints developers Forum: http://forum.eprints.org/
*** 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/
*** EPrints developers Forum: http://forum.eprints.org/

*** 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/
*** EPrints developers Forum: http://forum.eprints.org/
*** 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/
*** EPrints developers Forum: http://forum.eprints.org/