傳電子郵件
mailx [-s subject ] [-r name<[email protected]>] [-a /path/to/file] [-S SMTP ] [email protected] < message.txt
-S smtp="mail.example.com:587"
-S smtp-use-starttls
-S smtp-auth=login
-S smtp-auth-user="[email protected]"
-S smtp-auth-password="password"
-S ssl-verify=ignore
使用者登入登出時傳送通知
user@user-pc:~/$ cat ~/.bashrc
# .bashrc
pinky user | mailx -s "Security Alert" -r "user<[email protected]>" -S "0.0.0.0" [email protected]
user@user-pc:~/$ cat ~/.bash_logout
# ~/.bash_logout
echo "User logout!!" | mailx -s "Security Alert" -r "user<[email protected]>" -S "0.0.0.0" -a ~/.bash_history [email protected]
Another method: Use sendmail to send email in Linux