Linux - 从 gmail 中继读取电子邮件和 运行 脚本
Linux - read emails and run script from gmail relay
我正在使用 Ubuntu 并将 postfix 设置为使用 gmail 作为中继发送邮件 guide. I can send emails fine but I would like to receive emails and run a script like this. 是否可以从我的中继接收电子邮件然后 运行 bash 脚本?
我们想通了,使用 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 'username@gmail.com' 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
我正在使用 Ubuntu 并将 postfix 设置为使用 gmail 作为中继发送邮件 guide. I can send emails fine but I would like to receive emails and run a script like this. 是否可以从我的中继接收电子邮件然后 运行 bash 脚本?
我们想通了,使用 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 'username@gmail.com' 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