Mail from smtp command
The mail
command!
The mail
command is a simple command-line email client that allows you to send and receive email using the Simple Mail Transfer Protocol (SMTP). Here are some basic commands you can use with mail
:
Sending an email:
mail -s "Subject" [email protected]
: Send an email with a subject line to the specified recipient.mail -s "Subject" [email protected] < message.txt
: Send an email with a subject line and a message body from a file namedmessage.txt
.mail -s "Subject" [email protected] -c "CC: [email protected]"
: Send an email with a subject line and CC a recipient.
Receiving email:
mail
: Check for new email and display the list of messages.mail -f
: Check for new email and display the list of messages, including deleted messages.mail -d
: Delete all messages in the mailbox.
Other commands:
mail -r
: Reply to a message.mail -f <message_number>
: Forward a message.mail -d <message_number>
: Delete a message.mail -s
: Set the sender's email address.mail -c
: Set the CC recipient's email address.
SMTP commands:
The mail
command uses the SMTP protocol to send and receive email. Here are some basic SMTP commands:
HELO
: Hello command, used to initiate a connection with an SMTP server.MAIL FROM
: Specify the sender's email address.RCPT TO
: Specify the recipient's email address.DATA
: Send the email message body.QUIT
: Close the SMTP connection.
Keep in mind that the mail
command is a simple email client, and it may not support all the features and options available in more advanced email clients like Gmail or Outlook.