Author Topic: sendEmail Server  (Read 3984 times)

Pi3141

  • Newbie
  • *
  • Posts: 1
    • View Profile
on: April 26, 2018, 11:41:48 AM
Hi, i have a problem with sendEmail, i would like to use my pc as a stmp server (in localhost), could someone help me?

command:
sendemail -f mail@acaso.com -t  miaemail@mail.com -u ciao -m hey

Error:
apr 26 10:37:26 asus sendemail[5494]: ERROR => Connection attempt to localhost:25 failed: IO::Socket::INET6: connect: Connection refused



drego85

  • Global Moderator
  • Full Member
  • *****
  • Posts: 128
    • View Profile
    • Andrea Draghetti
Reply #1 on: April 28, 2018, 12:14:36 PM
It's very simple, you do not have a SMTP server installed on your BackBox.

You have two alternatives:
1. Install and Configure PostFix (How TO: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-16-04)
2. Use an external SMTP server (es. sendemail -f fromuser@gmail.com -t touser@domain.com -u subject -m "message" -s smtp.gmail.com:587 -o tls=yes -xu gmailaccount@gmail.com -xp gmailpassword)

Andrea Draghetti
Personal Blog


ostendali

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 583
    • View Profile
Reply #2 on: May 01, 2018, 12:18:33 PM
in order to send emails from your pc you do not necessarily need an smtp server.

either follow what drego85 suggested or simply install postfix "apt install posfix mailx && systemctl enable/start postfix" and simply send email i.e:

echo "Email test" | mail -s "This email sent : $( date '+%d/%m/%Y' ) from $( hostname )" youremail@example.com

or look at mail command man page