3

How I can send a simple mail from Ubuntu command line without giving the password for the email account which I'm sending to?

muru
  • 197,895
  • 55
  • 485
  • 740
Ken
  • 41
  • If the question below worked, be sure to accept it by toggling the grey tick just beneath the answer's downvote button – TellMeWhy Nov 26 '15 at 10:23
  • "The password for the account you're sending *to*"? No mail service asks the target account's password. O.o – muru Nov 26 '15 at 10:27
  • @muru I think OP meant "without password for the email account I'm using"? – TellMeWhy Nov 26 '15 at 10:29
  • 1
    @DevRobot That's what I think too. But I wonder if they used some command which asked for some password which they mistook for the target account's pw. – muru Nov 26 '15 at 10:31

2 Answers2

4
sudo apt-get install mailutils
mail -s "Subject" email@email.com

Press enter and write the subject of your email. Use Ctrl+D to continue.

You will be asked if you want to mark a copy of the mail to any other address - you can skip that with Ctrl+D.

The email will now be sent to your chosen address.

TellMeWhy
  • 17,484
  • On 14.04, at least you must install the package mailutils first: The program 'mail' is currently not installed. You can install it by typing: sudo apt-get install mailutils – Mark Kirby Nov 26 '15 at 09:34
4
echo "Mail text" | mail -s "Subject" your@mail.com
muru
  • 197,895
  • 55
  • 485
  • 740
shamsky
  • 104