How do i send an email from command prompt?

command, email, linux, smtp

Solution

Version for terminal:

mail somebody@gmail.com

Version for shell scripts:

echo "This is a short email" | mail -n -s "Sending email" somebody@gmail.com

AFAIK typical Linux distribution install MTA (sendmail/postfix/exim/...) by default. If you have static public IP address then its quite possible you have a working self-configuration.

Configuration of MTA without static public IP is more tricky.

Problem

Is there any way to send a simple email as such at linux terminal? ``` to: somebody@gmail.com sub: Sending email from linux terminal body: This is a short email sent from linux terminal ``` What kind of stack or smtp do i need to setup? How do I set them up?

Original source