Sending mails from Linux Machine
– Have hostname entry in “/etc/hosts”, if sending mail within the system
– System should have internet connectivity, for this.
Basic Examples
# mail -s “Hello Mike” mike@centos.test
# mail mike@centos.test
# echo “test” | mail -s “Hi Mike” mike@gmailer.com
|
– Sending mail with attachment
# mail -a test.txt mike@gmailer.com
– Sending mail with blind carbon copy
# mail -a test.txt -b mike@gmailer jackson@gmailer.com
– Sending mail with carbon copy
# mail -a test.txt -c mike@gmailer jackson@gmailer.com
– To save the message after sending the mail
# mail -F “/var/mike.mail” mike@gmailer.com
– To see the headers of all the received mails
# mail -H
– To start the mail message with the content from a file (mail message will start with the file contents)
# mail -q /var/mike.mail mike@gmailer.com
– To read mail of any user
# mail -u mike
– To see the details of the delivery of the mail you are sending
# mail -v mike@gmailer.com
|