linuxはemailをインストールして、メールを送信して監視します

988 ワード

一、yumコマンドでインストール
yum -y install sendmail
yum install -y mail
yum install -y mutt

二、emailコマンドを起動してemailの運転状態を表示する:/etc/init.d/sendmail status email:/etc/initを起動します.d/sendmail start
三、テスト
echo 'test' | mail -s 'test'   [email protected]

構文:
-sメールの件名を指定-c写した人を指定-a送信した添付ファイルを指定-fどの受信ボックスからコンテンツを読み込むかを指定し、eg,-f/home/wahahahaha/mb
echo "hello,this is the content of mail.welcome to www.mzone.cc"| mail -s "Hello from mzone.cc by pipe"  -c [email protected] [email protected]
受信者の設定(編集/etc/mail.rc):
# sendmail config
set [email protected]
set smtp=smtp.126.com
set [email protected]
set smtp-auth-password=xxxx
set smtp-auth=login

注意:emailステータスを表示するとsendmailは死んでいますが、subsysはsm-client(pid 10853)にロックされて実行されています...
解決策:postfixサービスステータスの表示:service postfix status postfix停止(起動時):service postfix stop再起動emailサービス:/etc/init.d/sendmail restart