Aix mail command examples
Here are some examples of the mail
command on AIX:
Sending an email
mail -s "Subject" [email protected]
- sends an email with the specified subject to the recipient.mail -s "Subject" [email protected] < message.txt
- sends an email with the specified subject and body from a file namedmessage.txt
to the recipient.
Reading email
mail
- reads the email inbox and displays the list of messages.mail -f
- reads the email inbox and displays the list of messages, with the option to delete or reply to messages.mail -r
- reads the email inbox and displays the list of messages, with the option to delete or reply to messages, and also allows you to read the body of the messages.
Deleting email
mail -d message_number
- deletes the message with the specified number.mail -d *
- deletes all messages in the inbox.
Replying to email
mail -r message_number
- replies to the message with the specified number.mail -r message_number -c "Comment"
- replies to the message with the specified number and adds a comment.
Forwarding email
mail -f message_number [email protected]
- forwards the message with the specified number to the specified recipient.mail -f message_number -c "Comment" [email protected]
- forwards the message with the specified number to the specified recipient and adds a comment.
Other options
mail -a "From: [email protected]"
- sets the from address for the email.mail -a "To: [email protected]"
- sets the to address for the email.mail -a "CC: [email protected]"
- sets the CC address for the email.mail -a "BCC: [email protected]"
- sets the BCC address for the email.
Note: The mail
command on AIX is a simple command-line email client, and it may not have all the features of a full-fledged email client like IBM Notes or Microsoft Outlook.