msmtp本身是支持多个msmtp的。这些smtp的可以通过mutt的set from='xxx'来选取。因此,mutt能否使用多个smtp的问题就等价于是mutt能否根据不同情况改变from的值。事实上,mutt的send hook整好可以用来解决这个问题。请看我的mutt配置文件
set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="Jianing Yang"
set envelope_from=yes
set from=mycompany@email.com
send-hook '~f detrox@gmail.com' 'set from=detrox@gmail.com'
send-hook '~t detrox@gmail.com' 'set from=detrox@gmail.com'
send-hook '~t [^@]+@jianingy.com' 'set from=detrox@gmail.com'
通过上面的配置,mutt在发送邮件时会根据如下条件改变from地址:
1.邮件来自detrox@gmail.com
2.邮件是发往detrox@gmail.com
3.邮件是发往@jianingy.com域的

Leave a comment