-2
我使用的是Ubuntu,并设置了Postfix以使用Gmail作为中继来发送邮件以下guide.我可以发送电子邮件,但我希望收到电子邮件并运行脚本像this.是否可以从我的中继接收电子邮件,然后运行bash脚本?Linux - 从Gmail中读取电子邮件和运行脚本
我使用的是Ubuntu,并设置了Postfix以使用Gmail作为中继来发送邮件以下guide.我可以发送电子邮件,但我希望收到电子邮件并运行脚本像this.是否可以从我的中继接收电子邮件,然后运行bash脚本?Linux - 从Gmail中读取电子邮件和运行脚本
我们使用fetchmail来抓取电子邮件,然后用procmail来运行脚本。
/root/.fetchmailrc
# set username
set postmaster "root"
# set polling time (5 minutes)
set daemon 600
poll pop.gmail.com with proto POP3
user '[email protected]' there with password 'password' is root here options ssl mda "/usr/bin/procmail -m /etc/procmail/procmail.conf";
/etc/procmail/procmail.conf
CORRECTHOME=/root
MAILDIR=$CORRECTHOME/
LOGFILE=/var/log/procmail/log
VERBOSE=on
:0
| /root/procmail/script_to_run.sh