How I can send a simple mail from Ubuntu command line without giving the password for the email account which I'm sending to?
Asked
Active
Viewed 2.0k times
3
-
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 Answers
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,124
- 39
- 95
- 141
-
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
3
-
How is this any better than [DevRobot's answer](http://askubuntu.com/a/702709/158442)? – muru Nov 26 '15 at 10:59
-
3sending mail whithout text typing, can do some nice things like df -h | mail -s "Disk Info" my@mail.com, redirect logs to your email sudo cat /var/log/syslog | mail -s "logs" my@mail.com. Just a suggestion... – shamsky Nov 26 '15 at 11:13