2019-06-27 14:33:23 1809瀏覽
今天千鋒扣丁學(xué)堂Linux培訓(xùn)老師給大家分享一篇關(guān)于如何用Linux命令行發(fā)電子郵件的詳細(xì)介紹,首先Linux可以用多種方式通過命令行發(fā)送電子郵件。有一些方法十分簡單,有一些相對會復(fù)雜一些,不過仍舊提供了很多有用的特性。選擇哪一種方式取決于你想要什么——向同事快速發(fā)送消息,還是向一批人群發(fā)帶有附件的更復(fù)雜的信息。接下來看一看幾種可行方案。
$ echo "Reminder: Leaving at 4 PM today" | mail -s "early departure" myboss
$ mail -s "Reminder:Leaving early" myboss < reason4leaving
$ echo "leaving now" | sendmail recip
$ echo "Subject: leaving now" | sendmail recip
Subject: Requested lyrics I would just like to say that, in my opinion, longer hair and other flamboyant affectations of appearance are nothing more ...
$ sendmail recip < lyrics
$ sendmail -v recip@emailsite.com < lyrics
$ echo "Please check last night's backups" | mutt -s "backup check" recip
$ mutt -s "Agenda" recip < agenda
$ mutt -s "Agenda" recip -a agenda -a speakers < msg
$ echo "" | mutt -s "Agenda" recip -a agenda -a speakers
$ mutt -s "Minutes from last meeting" recip@somesite.com -c myboss < mins
$ telnet emailsite.org 25 Trying 192.168.0.12... Connected to emailsite. Escape character is '^]'. 220 localhost ESMTP Sendmail 8.15.2/8.15.2/Debian-12; Wed, 12 Jun 2019 16:32:13 -0400; (No UCE/UBE) logging access from: mysite(OK)-mysite [192.168.0.12] EHLO mysite.org <== introduce yourself 250-localhost Hello mysite [127.0.0.1], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-EXPN 250-VERB 250-8BITMIME 250-SIZE 250-DSN 250-ETRN 250-AUTH DIGEST-MD5 CRAM-MD5 250-DELIVERBY 250 HELP MAIL FROM: me@mysite.org <== 指定發(fā)件人 250 2.1.0 shs@mysite.org... Sender ok RCPT TO: recip <== 指定收件人 250 2.1.5 recip... Recipient ok DATA <== 郵件內(nèi)容開始 354 Enter mail, end with "." on a line by itself This is a test message. Please deliver it for me. . <== 內(nèi)容結(jié)束 250 2.0.0 x5CKWDds029287 Message accepted for delivery quit <== 結(jié)束交互
$ for recip in `cat recips` do mutt -s "Minutes from May meeting" $recip < May_minutes done
【關(guān)注微信公眾號獲取更多學(xué)習(xí)資料】 【掃碼進(jìn)入HTML5前端開發(fā)VIP免費(fèi)公開課】
查看更多關(guān)于“Linux培訓(xùn)資訊”的相關(guān)文章>>