1

I'm trying to learn the Linux command mail and so I tried sending a simple message to myself via the following sequence of commands from the terminal:

> mail -s "Hello World" [email protected]
> <Enter>
> Cc:
> <Enter>
> Test message
> <Enter>
> <Ctrl+d>

The terminal then returns to the prompt I started with. I am not receiving the email in my gmail account, though (it's not in spam, either). I'm using Ubuntu. Any thoughts on troubleshooting?

Update: I followed the configuration given here, but then when I entered the above commands I got an email from Google stating they blocked a sign in attempt "from an app that doesn't meet modern security standards."

Update 2: I went through the tutorial given below (link) but am still unable to send mail. However, I now get the command line message

~$ send-mail: authentication failed (method PLAIN)
send-mail: server message: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbv2h
send-mail: server message: 534-5.7.14 uISOTfHhetkRKAzV55Xrqy1sBK3ti2FcFdj5T33g6aZcZ2Ue1xaqVs8BFtm5Plrq7vrcJm
send-mail: server message: 534-5.7.14 YNad84IiP4p-Tc61duh6UjDAoRnvv9NnYE1krHK-xzCRQtg_i1xSqZBRjkhLzwell5fTGG
send-mail: server message: 534-5.7.14 hGZAHZ2kS8Wj5ZakAcoao9R-wJ3aBFeC7-vzewWwy95CKKAck6DzB1xXqa62H38xxCHr7W
send-mail: server message: 534-5.7.14 31sJWYOMgBOB6_w_Y52FQOo82wuc> Please log in via your web browser and
send-mail: server message: 534-5.7.14 then try again.
send-mail: server message: 534-5.7.14  Learn more at
send-mail: server message: 534 5.7.14  https://support.google.com/mail/answer/78754 f7sm45326174qhf.7 - gsmtp
send-mail: could not send mail (account default from /home/<username>/.msmtprc)

I was already logged in to my gmail on my browser. Of course I visited the link https://support.google.com/mail/answer/14257?rd=1 in the error message, but still nothing.

3
  • Did you configure mailutils ?
    – clhy
    Commented Jan 7, 2016 at 2:01
  • @The_IT_Guy_You_Don't_Like Okay, I just went through these steps: rianjs.net/2013/08/…. I then re entered the above commands and got an email from Google saying they blocked a sign in attempt as soon as I sent it. Any thoughts on getting around this?
    – bcf
    Commented Jan 7, 2016 at 2:19
  • I am quire sure its being blocked for the same reasons as mentioned by @trinsic. Why don't you setup some other email address to test
    – clhy
    Commented Jan 7, 2016 at 8:36

2 Answers 2

3

I think maybe Google will not accept messages from a host without proper authentication setup. They'll claim to accept them, but this is mainly to prevent spammers from figuring it out.

You might need to check your authentication settings, here is a guide to setup mail sending from command line using gmail: http://tuxtweaks.com/2012/10/send-gmail-from-the-linux-command-line/ let me know if that helps.

1
  • to add to your update #2: if im reading your output correctly, you cant send email using plain authentication to gmail. It needs to be setup with proper authentication using a proper .msmtprc config. Also you might have further issues with Googles 2-Step Verification google.com/landing/2step you will either need to make sure you are not sending plain text auth and or see if you have 2-step auth enabled and if so you may need to adjust your config accordingly. I dont have a gmail account myself so I cant test. I wouldnt agree with davidgos response sendmail require a proper domain
    – trinsic
    Commented Jan 7, 2016 at 18:27
1

"mail" should use "sendmail" to actually send the emails. This being the case, you should look at the log files (it varies by distro, but /var/log/mail.log or similar would be typical) to confirm that sendmail is actually receiving and sending the email - and what is happening.

Of-course, this probably presupposes you have a sendmail compatible mail server (like sendmail or postfix).

Also, sending email through your own system is fraught with difficulties due to spam filters - you really need to relay through a reputable mail provider unless you want to jump through A LOT of hoops - thanks, of-course, to spammers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .