Mail from command line
You can send emails from the command line using various tools and commands. Here are a few options:
- mail: The
mail
command is a simple way to send emails from the command line. It's available on most Linux and macOS systems.
Example:
mail -s "Subject" [email protected]
This will open a text editor where you can compose your email. When you're done, save the file and exit the editor. The email will be sent.
- mutt:
mutt
is a popular email client that can be used from the command line. It's available on most Linux and macOS systems.
Example:
mutt -s "Subject" [email protected]
This will open a text-based email interface where you can compose and send your email.
- msmtp:
msmtp
is a command-line email client that can be used to send emails using a variety of protocols, including SMTP.
Example:
msmtp -a account -s "Subject" [email protected]
Replace account
with the name of your email account.
- s-nail:
s-nail
is a command-line email client that's similar tomutt
. It's available on most Linux and macOS systems.
Example:
s-nail -s "Subject" [email protected]
This will open a text-based email interface where you can compose and send your email.
- curl:
curl
is a command-line tool that can be used to send emails using the SMTP protocol.
Example:
curl -s -X POST \
https://smtp.example.com:587 \
-u "username:password" \
-F "[email protected]" \
-F "[email protected]" \
-F "subject=Subject" \
-F "body=Hello%20World!"
Replace smtp.example.com
with your email server's hostname or IP address, username
and password
with your email account credentials, and [email protected]
with the sender's email address.
These are just a few examples of how you can send emails from the command line. The specific commands and options may vary depending on your email provider and the tools you're using.