0

I'm creating a script to receive an email every time someone connects/logs in via SSH to my Linux server. The script is already working, but my issue is with sending the email.

I'm using the following command:

sendemail -f [email protected] -t [email protected] -u "SSH LOGIN TO THE SERVER!" -m "ATTEMPTED LOGIN TO THE SERVER" -s smtp-mail.outlook.com:587 -xu [email protected] -xp PASSWORD`

And I receive the following error:

Jan 17 17:14:10 user sendemail[1700]: ERROR => TLS setup failed: hostname verification failed

Error message

I've tried it with port 25 and it returns timeout error:

Jan 17 17:24:59 user sendemail[1711]: ERROR => Timeout while connecting to smtp-mail.outlook.com:25 There was no response after 60 seconds.

I tried with mutt and mailx as well, but it didn't work either...

I'm using an EC2 VM on AWS, and I've opened the ports in the firewall. Anyone know what might be the issue? I tested the same command locally on Ubuntu with the same credentials, and it works, but not on EC2.

7
  • do you mean sendmail or sendemail?? Commented Jan 18, 2024 at 17:13
  • @MarcusMüller I meant 'sendemail,' but there's no such flag, so I used 'sendmail' instead. Commented Jan 18, 2024 at 17:15
  • 1
    don't do that! That tag refers to a different program, so incorrectly tagging it makes your question worse. I don't know sendemail, so I can't help with your problem :( Commented Jan 18, 2024 at 17:24
  • I'm sorry, I didn't know.. Commented Jan 18, 2024 at 17:27
  • Don't worry, no harm done :) Commented Jan 18, 2024 at 18:06

1 Answer 1

0

I use Debian12. Due to a bug, "sendemail" works in Debian11 but not in Debian12; in that case I copy the file "/usr/share/perl5/IO/Socket/SSL.pm" from Debian11 to Debian12 and it works.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.