一、出現cannot send message: Process exited with a non-zero status錯誤
查看log文件:sudo cat /var/log/mail.err,發現存在如下問題:Sep 19 10:07:35 ubuntu postfix/sendmail[38195]: fatal: open /etc/postfix/main.cf: No such file or directory
方法:
sudo dpkg-reconfigure postfix
配置選擇:Internet Site=>System mail name:保持默認(如:ubuntu)=>其他的都選默認的,配置完成后就存在/etc/postfix/main.cf文件了
然后就可以使用mail命令了
二、mail命令的使用
#將d3.csv文件內容發送給314104490,郵件主題是hello mail -s 'hello' 314104490@qq.com < d3.csv #在linux下使用mail命令發送附件:首先需要安裝uuencode軟件包,這個程序是對二進制文件進行編碼使其適合通過郵件進行發送 sudo apt-get install sharutils #uuencode 需要兩個參數,第一個是你要發送的文件,第二個是附件顯示的文件名 uuencode d3.csv D3.csv | mail -s 'This is 3D' 314104490@qq.com < d3.csv #將文件d3.csv以附件發送,附件名為D3.csc,郵件內容為d3.csv(郵件內容部分) #發送圖片
目前沒找到合適的發送圖片的方法,如果有看到發送圖片郵件方法的還請留言
三、ssh localhost
出錯:ssh_exchange_identification: read: Connection reset by peer
sudo vi /etc/hosts.deny#注釋掉all sudo vi /etc/hosts.allow