Emailer com mail
You're looking for a way to send emails using a command-line tool!
There are several options available, but I'll introduce you to two popular ones: mail
and sendmail
.
1. mail
command
The mail
command is a simple, built-in tool on many Linux and macOS systems. It allows you to send emails from the command line. Here's a basic syntax:
mail -s "Subject" [email protected]
Replace Subject
with the subject of your email, and [email protected]
with the email address of the recipient.
You can then type your email message, and it will be sent using the default email client or the system's mail server.
2. sendmail
command
sendmail
is a more powerful and flexible email client that can be used on various platforms, including Linux, macOS, and Windows. Here's a basic syntax:
sendmail -t -i [email protected]
The -t
option tells sendmail
to read the email message from standard input, and the -i
option specifies the recipient's email address.
You can then type your email message, and it will be sent using the sendmail
client.
Additional options and tips
- To specify a sender email address, use the
-f
option followed by the sender's email address. For example:mail -s "Subject" -f [email protected] [email protected]
- To attach a file, use the
-a
option followed by the file path. For example:mail -s "Subject" -a /path/to/file [email protected]
- To use a specific SMTP server, use the
-S
option followed by the server's hostname or IP address. For example:mail -s "Subject" -S smtp.gmail.com [email protected]
- Make sure you have a working email client or mail server configured on your system for these commands to work.
Remember to check the documentation for your specific system and email client for more options and configuration details.