Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send email from Linux command line to Gmail

There appear to be a number of answers to this question, but none of them seem to work: I would like to send email from my localhost to a gmail account. The following command does nothing as far as I can tell:

mail -s "Hello!" [email protected]

After Ctrl-Ding to finish editing, there is no failure notification or anything, and the message never appears in that gmail account's inbox (or spam folder). I've tried various different ways of using that command from around the internet, but it appears that it just silently fails to send to nonlocal addresses. Any ideas? I am using Debian Wheezy

EDIT: To be clear, the issue is not that I get command line prompts, which I know I can avoid with pipes etc. The issue is that mail is simply never sent. The command returns after a while, and it just silently fails.

Thanks!

like image 241
Carson McNeil Avatar asked Feb 10 '26 01:02

Carson McNeil


1 Answers

Make sure postfix or the MTA of your choice is installed and running.

sudo /etc/init.d/postfix status
like image 145
usr242 Avatar answered Feb 12 '26 16:02

usr242



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!