?????????????????? Linux ???????????????????????????????????????????????????????????????£??? Cachet?????????????? Monit????????????? RAID mdadm???????????????????? ???????????? ???????? ??????????????????????? SMTP ?????????????????????????
???????? Gmail ?????????? ??? SMTP ?????? ?????????????з????????????????????????? Gmail ?? SMTP ??????????????????????ɡ?
??????? Gmail ?? SMTP ?????????????Щ???????Щ????????????????Щ???????÷?????????????????????????????????????????????????????? 100 ???????????????????????? 500 ??????????????????????????????????????????????????????????????????κ???????????? Gmail ??????????????????????????Gmail ?? SMTP ????????????????????????????????????????????????
????????????????????????? ????? Linux ????????? Gmail ?? SMTP ?????? ???
????Google Gmail SMTP ??????????
???????????????????????? Gmail ?? SMTP ??????????????????μ????????????????
???????????????? ??SMTP ????????: smtp.gmail.com
??????????: ??
??????e??????: ??
?????????: ??? Gmail ??? ID ?????? “alice” ????????????? alice@gmail.com??
????????: ??? Gmail ????
???????: 587
??????е????????????????????????????????????????????Щ?? Linux ????? Gmail SMTP ????????????????
???????????з??????
?????????????????????????????????????????? Gmail SMTP ?????????????з??????????????????????????? mutt ?????????????????
???????? mutt??
???????? Debian-based ????
????$ sudo apt-get install mutt
???????? Red Hat based ????
????$ sudo yum install mutt
??????????? mutt ?????????~/.muttrc??????????????????????????? Gmail SMTP ????????????? <gmail-id> ?滻??????? Gmail ID?????????????????????????????????????????
????$ vi ~/.muttrc
????set from = "<gmail-id>@gmail.com"
????set realname = "Dan Nanni"
????set smtp_url = "smtp://<gmail-id>@smtp.gmail.com:587/"
????set smtp_pass = "<gmail-password>"
?????????????? mutt ????????????
????$ echo "This is an email body." | mutt -s "This is an email subject" alice@yahoo.com
??????????????????????????? “-a” ???
????$ echo "This is an email body." | mutt -s "This is an email subject" alice@yahoo.com -a ~/test_attachment.jpg

??????? Gmail SMTP ????????ζ??????????????? Gmail ?????????????仰?????????????? Gmail ??????????????????????????????????????????????????????? Gmail SMTP ???????
??????????????????????????
??????????? ??????÷???????VPS?? ??????Щ???????????????? VPS ????????????????????????????????????о????????? VPS ??????????????????????????????????? VPS ???????? systemd??????????????????????????????????? systemd ???????
?????????????????? reboot_notify.sh????????????????
????$ sudo vi /usr/local/bin/reboot_notify.sh
????#!/bin/sh
????echo "`hostname` was rebooted on `date`" | mutt -F /etc/muttrc -s "Notification on `hostname`" alice@yahoo.com
????$ sudo chmod +x /usr/local/bin/reboot_notify.sh
?????????????У?????? “-F” ???????????????? mutt ???????λ?á????????????? /etc/muttrc ?????????????????????????? Gmail SMTP ?????
?????????????????????????????? systemd ????
????$ sudo mkdir -p /usr/local/lib/systemd/system
????$ sudo vi /usr/local/lib/systemd/system/reboot-task.service
????[Unit]
????Description=Send a notification email when the server gets rebooted
????DefaultDependencies=no
????Before=reboot.target
????[Service]
????Type=oneshot
????ExecStart=/usr/local/bin/reboot_notify.sh
????[Install]
????WantedBy=reboot.target
??????????????????????÷???
????$ sudo systemctl enable reboot-task
????$ sudo systemctl start reboot-task
????????????????? VPS ????????????????????????