1

I used the following command to send an email

echo "Body of the mail" | mail -s "subject" "something@gmail.com"

The first time I ran it, it returned an error saying the program mail is not installed. After searching a bit, I fired the following command and it seems to have installed the program mail.

sudo apt-get install mailutils

I again tried to send the mail. This time the command did not return any error (I used $? to check the return value of the command.) So I thought the mail was sent successfully. However, I have not received it in my mailbox. I checked the junk/spam folders too, before anyone points that out.

What could be the reason?

I ask this question because there seems to be some caveat which no one talks about while using the mail command. All the answers I've seen so far just give the command to be used. But is there any setting that must be done before one can send an email from Bash?

0

You must install Postfix and configure it.

  • I'd appreciate some more information about that. – RodrikTheReader Mar 3 '17 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.