EPrints Technical Mailing List Archive

Message: #09258


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

[EP-tech] {Suspected SPAM} Re: Eprints SMPT configuration Error with Office 365

  • To: David R Newman <drn@ecs.soton.ac.uk>
  • Subject: [EP-tech] {Suspected SPAM} Re: Eprints SMPT configuration Error with Office 365
  • From: Mosys Consultancy Services Pvt Ltd <mosyssw@gmail.com>
  • Date: Tue, 28 Mar 2023 06:59:47 +0530

CAUTION: This e-mail originated outside the University of Southampton.
David,
Thanks for your response.
The error message you are getting suggesting Postfix is not running on the port required.  By default Postfix runs on TCP port 25 (SMTP) but your EPrints looks to be trying to find it on port 587.
Yes, it is running on port 25 
root@eprints:/home/mosys# netstat -tulpn | grep :25
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      94170/master

Have you changed the settings in cfg.d/email.pl? Specifically have you changed the configuration setting for $c->{send_email} either in this file or some other file in a cfg.d/ directory?
No. this is the line available here 
$c->{send_email} = \&EPrints::Email::send_mail_via_smtp;

 Have you modified perl_lib/EPrints/Email.pm? 
Yes. I have changed as follows
sub send_mail_via_smtp
{
    my( %p ) = @_;
    eval 'use Net::SMTP::TLS';
    my $repository = $p{session}->get_repository;
    my $smtphost = $repository->get_conf( 'smtp_server' );
    if( !defined $smtphost )
    {
        $repository->log( "No STMP host has been defined. To fix this, find the full\naddress of your SMTP server (eg. smtp.example.com) and add it\nas the value of smtp_server in\nperl_lib/EPrints/SystemSettings.pm" );
        return( 0 );
    }
use Net::SMTP::TLS;
  my $smtp = Net::SMTP::TLS->new(
        $smtphost,
        Hello   =>      'localhost',
        Port    =>      587,
        User    =>      'myemail@xyz.com',
        Password=>      'password'
      );


Did you any other error messages around the same time as your highlighted message in any of your Apache logs files?
Connect failed :IO::Socket::INET: connect: Connection refused
 at /usr/local/share/perl/5.30.0/Net/SMTP/TLS.pm line 113.
Net::SMTP::TLS::new("Net::SMTP::TLS", "0.0.0.0", "Hello", "localhost", "Port", 587, "User", "myemail@xyz", ...) called at /opt/eprints3/perl_lib/EPrints/Email.pm line 170
EPrints::Email::send_mail_via_smtp("to_email", "lrc_hyd\@isb.edu", "from_email", "myemail@xyz", "langid", "en", "replyto_email", "xxx@gmail.com", ...) called at /opt/eprints3/perl_lib/EPrints/Repository.pm line 1927
eval {...} called at /opt/eprints3/perl_lib/EPrints/Repository.pm line 1927
EPrints::Repository::call(EPrints::Repository=HASH(0x56323942f810), "send_email", "to_email", "lrc_hyd\@isb.edu", "from_email", "myemail@xyx", "langid", "en", ...) called at /opt/eprints3/perl_lib/EPrints/Email.pm line 124
EPrints::Email::send_mail("session", EPrints::Repository=HASH(0x56323942f810), "langid", "en", "to_name", "", "to_email", "lrc_hyd\@isb.edu", ...) called at /opt/eprints3/perl_lib/EPrints/Plugin/Screen/Public/RequestCopy.pm line 210
EPrints::Plugin::Screen::Public::RequestCopy::action_request(\Prints::Plugin::Screen::Public::RequestCopy=HASH(0x563233c1d8c8)) called at /opt/eprints3/perl_lib/EPrints/Plugin/Screen.pm line 240
EPrints::Plugin::Screen::from(EPrints::Plugin::Screen::Public::RequestCopy=HASH(0x563233c1d8c8)) called at /opt/eprints3/perl_lib/EPrints/ScreenProcessor.pm line 356
EPrints::ScreenProcessor::process("EPrints::ScreenProcessor", "session", EPrints::Repository=HASH(0x56323942f810), "url", "/cgi/request_doc", "screenid", "Public::RequestCopy") called at /opt/eprints3/cgi/request_doc line 39
ModPerl::ROOT::ModPerl::Registry::opt_eprints3_cgi_request_doc::handler(Apache2::RequestRec=SCALAR(0x563233c38128)) called at /usr/lib/x86_64-linux-gnu/perl5/5.30/ModPerl/RegistryCooker.pm line 207
eval {...} called at /usr/lib/x86_64-linux-gnu/perl5/5.30/ModPerl/RegistryCooker.pm line 207
ModPerl::RegistryCooker::run(ModPerl::Registry=HASH(0x563233c38188)) called at /usr/lib/x86_64-linux-gnu/perl5/5.30/ModPerl/RegistryCooker.pm line 173
ModPerl::RegistryCooker::default_handler(ModPerl::Registry=HASH(0x563233c38188)) called at /usr/lib/x86_64-linux-gnu/perl5/5.30/ModPerl/Registry.pm line 32
ModPerl::Registry::handler("ModPerl::Registry", Apache2::RequestRec=SCALAR(0x563233c38128)) called at -e line 0
eval {...} called at -e line 0

this is the error we are getting on browser. 

thanks
Revathi

On Mon, Mar 27, 2023 at 6:11 AM David R Newman <drn@ecs.soton.ac.uk> wrote:
Hi Revathi,

The error message you are getting suggesting Postfix is not running on the port required.  By default Postfix runs on TCP port 25 (SMTP) but your EPrints looks to be trying to find it on port 587.  I think this is because you are trying to using TLS encryption for the local connection between EPrints and Postfix on your server.  I am not sure what would cause EPrints to use Net::SMTP::TLS by default.  I have tried installing this Perl module using CPAN and I still use regular (non-encrypted) SMTP locally on TCP Port 25.  I would not reconfigure Postfix for run on port 587 using TLS.  As that would likely take a lot of effort and add unnecessary complexity with no real benefit. 

Have you changed the settings in cfg.d/email.pl?  Specifically have you changed the configuration setting for $c->{send_email} either in this file or some other file in a cfg.d/ directory?  Based in you running EPrints 3.4.4 (according to your /cgi/counter page on eprints.exchange.isb.edu), line 178 of perl_lib/EPrints/Email.pm does not look to be a line that include a call to Net::SMTP::TLS::new.  Have you modified perl_lib/EPrints/Email.pm?  Did you any other error messages around the same time as your highlighted message in any of your Apache logs files?

Regards

David Newman

On 26/03/2023 2:09 pm, Mosys Consultancy Services Pvt Ltd via Eprints-tech wrote:
CAUTION: This e-mail originated outside the University of Southampton.
Dear All,
Could anyone please help me to resolve the issue of Office365 SMTP Configuration issue with eprints.exchange.isb.edu. Let me clear what I have done so far.
2. It is working well with mail command without any isssue
3. Email.pm and SystemSettings.pm have been configured accordingly
4, Followed this thread https://www.eprints.org/eptech/msg07173.html and tested with test_sendmail.pl and working perfectly.
I am facing the following error

Connect failed :IO::Socket::INET: connect: Connection refused
 at /usr/local/share/perl/5.30.0/Net/SMTP/TLS.pm line 113.
	Net::SMTP::TLS::new("Net::SMTP::TLS", "localhost", "Hello", "localhost", "Port", 587, "User", "******email", ...) called at /opt/eprints3/perl_lib/EPrints/Email.pm line 178
	EPrints::Email::send_mail_via_smtp("sig", XML::LibXML::DocumentFragment=SCALAR(0x55c2ec290348), "to_email", "lrc_hyd\@isb.edu", "cc_list", ARRAY(0x55c2ec28fc70), "replyto_email", "****@gmail.com", ...) called at /opt/eprints3/perl_lib/EPrints/Repository.pm line 1927 
eval {...} called at /opt/eprints3/perl_lib/EPrints/Repository.pm line 1927"
 
Could anyone please help me out?

thanks
Revathi

*** 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/