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:

  1. mail -s "Subject" [email protected]: Send an email with a subject line to the specified recipient.
  2. mail -s "Subject" [email protected] < message.txt: Send an email with a subject line and a message body from a file named message.txt.
  3. mail -s "Subject" [email protected] -c "CC: [email protected]": Send an email with a subject line and CC a recipient.

Receiving email:

  1. mail: Check for new email and display the list of messages.
  2. mail -f: Check for new email and display the list of messages, including deleted messages.
  3. mail -d: Delete all messages in the mailbox.

Other commands:

  1. mail -r: Reply to a message.
  2. mail -f <message_number>: Forward a message.
  3. mail -d <message_number>: Delete a message.
  4. mail -s: Set the sender's email address.
  5. 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:

  1. HELO: Hello command, used to initiate a connection with an SMTP server.
  2. MAIL FROM: Specify the sender's email address.
  3. RCPT TO: Specify the recipient's email address.
  4. DATA: Send the email message body.
  5. 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.