How can I send e-mail from linux command line?

-4

I have tried this, but it is not working:

mail -s 'Teszt' myaddress@gmail.com < notes.txt

Kovács Ákos

Posted 2013-10-25T13:06:10.423

Reputation: 13

Have you installed sendmail? – kobaltz – 2013-10-25T13:07:16.347

First check, if sendmail is installed. Than, replace the single quotes(') with double quotes(") – Christian – 2013-10-25T13:10:11.127

It is also possible with telnet, in addition to your method stated: http://www.wikihow.com/Send-Email-Using-Telnet

– Rudolph – 2013-10-25T13:18:50.177

5I would suggest you explain "not working", when you do I'll remove my -1. Does the email send, does it error.... More details please. – Dave – 2013-10-25T13:20:54.430

Dave Rook: There is no error message, but I have not got the e-mails. – Kovács Ákos – 2013-10-27T09:57:36.680

Answers

2

Many email providers will not accept traffic from an IP that's from a residental ISP. Furthermore, many ISPs block outgoing SMTP traffic. So you usually will have many problems trying to directly send email via SMTP from your home PC.

You probably need to install exim4 or other MTA, and configure it to use an external email as a "smarthost." Outgoing email will appear to come from this email address. On Debian this is fairly easy with an apt-get install exim4 and then answer the configuration questions.

If you are running on Debian or Ubuntu, you might have this installed already. Run dpkg-reconfigure exim4 from a root terminal to re-run the setup questions.

After you do that the above command will likely begin to work.

LawrenceC

Posted 2013-10-25T13:06:10.423

Reputation: 63 487