sendmail是一個(gè)用于發(fā)送郵件的命令行工具,常用于Linux系統(tǒng)。下面是sendmail命令的用法:
echo "This is the body of the email" | sendmail recipient@example.com
這個(gè)命令會(huì)將文本"This is the body of the email"作為郵件正文發(fā)送給recipient@example.com。
echo "This is the body of the email" | sendmail -s "Subject of the email" -f sender@example.com recipient@example.com
這個(gè)命令會(huì)將文本"This is the body of the email"作為郵件正文發(fā)送給recipient@example.com,同時(shí)指定郵件主題為"Subject of the email",發(fā)件人為sender@example.com。
(echo "This is the body of the email"; uuencode attachment.txt attachment.txt) | sendmail -s "Subject of the email" -f sender@example.com recipient@example.com
這個(gè)命令會(huì)將文本"This is the body of the email"作為郵件正文發(fā)送給recipient@example.com,同時(shí)指定郵件主題為"Subject of the email",發(fā)件人為sender@example.com,并且附加了名為attachment.txt的附件。
sendmail -t < email.txt
這個(gè)命令會(huì)從名為email.txt的文件中讀取郵件內(nèi)容,并發(fā)送。
以上是sendmail命令的一些常用用法,你可以根據(jù)自己的需求進(jìn)行調(diào)整和擴(kuò)展。