Sendmail command
The sendmail
command!
sendmail
is a command-line utility that allows you to send email messages from the command line. It's a part of the Sendmail mail transfer agent (MTA) package, which is a popular open-source MTA used on many Unix-like systems.
Here's a basic syntax for the sendmail
command:
sendmail [options] [email protected]
Where:
options
are optional flags that control the behavior of the command. Some common options include:-t
or--input-file
: Specify the input file containing the email message.-f
or--from
: Specify the sender's email address.-s
or--subject
: Specify the subject line of the email.-b
or--body
: Specify the body of the email message.
[email protected]
is the email address of the recipient.
Here are some examples of using the sendmail
command:
Sending a simple email
sendmail [email protected]
This will prompt you to enter the email message, subject, and sender's email address.
Sending an email with a specific subject
sendmail -s "Hello, World!" [email protected]
This will send an email with the subject "Hello, World!" to the recipient.
Sending an email with a specific body
sendmail -b "This is the email body." [email protected]
This will send an email with the body "This is the email body." to the recipient.
Sending an email with a specific sender
sendmail -f [email protected] [email protected]
This will send an email from the sender [email protected]
to the recipient.
Sending an email from a file
sendmail -t < email.txt [email protected]
This will send an email from the file email.txt
to the recipient.
Note that the sendmail
command is usually used in conjunction with other tools, such as mail
or mutt
, to compose and send email messages. Additionally, the sendmail
command may not work on all systems, as it's specific to Unix-like systems.