openwrt将短信转发到邮件
前文已经将SMS接收功能实现 https://www.cnblogs.com/d9394/p/17214652.html
稍为修改转发到邮件,邮件留存的作用比即时通信好多了
openwrt安装邮件发送工具:
opkg install ssmtp
修改/etc/ssmtp/ssmtp.conf
root=aaa@163.com mailhub=smtp.ym.163.com rewriteDomain=163.com hostname=163.com FromLineOverride=YES AuthUser=aaa@163.com AuthPass=11111111
修改/root/pushsms.sh
#!/bin/sh echo $1 $2>> /dev/shm/sms.log if [ "$1" == "RECEIVED" ]; then FROM=$(grep "From:" $2) TEXT=$(sed -e '1,/^$/ d' < "$2" | iconv -f UNICODEBIG -t UTF-8) ( echo "From:<aaa@163.com>"; echo "TO:bbbbb@gmail.com"; echo "Subject: sms from $FROM"; echo "Content-type: text/html;charset=utf-8"; echo $TEXT ) | ssmtp -v bbbbb@gmail.com fi
多个邮件用户可以这样写:
ssmtp -v a@bc.com,b@de.net,c@ghi.org