将多个SMTP电子邮件登录名添加到mailx [英] Add multiple SMTP email logins to mailx

查看:121
本文介绍了将多个SMTP电子邮件登录名添加到mailx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在mailx上设置多个电子邮件帐户(一个来自gmail,一个来自office365).当我只有一个时,它可以正常工作,但是如果我尝试添加另一个,则无论我使用-r选择什么电子邮件,mailx都将始终使用最后定义的服务器的SMTP详细信息.有没有一种方法可以添加多个要发送的帐户?在Google找不到有用的东西.

I'm trying to set up multiple email accounts on mailx (one from gmail and one from office365). When I had just one it worked fine but if I try to add another, mailx will always use the SMTP details from the last defined server regardless of what email I choose using -r. Is there a way to add multiple accounts to send from? Couldn't find anything useful off Google.

下面是我的/etc/mail.rc文件的末尾(在Centos 7上运行).

Below is the end of my /etc/mail.rc file (running on Centos 7).

set bsdcompat
set smtp=smtps://smtp.gmail.com:465
set smtp-auth=login
set smtp-auth-user=EMAIL1@gmail.com
set smtp-auth-password=PASSWORD1
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/

set bsdcompat
set smtp=smtp.office365.com:587
set smtp-use-starttls
set smtp-auth=login
set smtp-auth-user=EMAIL2@office.com
set smtp-auth-password=PASSWORD2
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/

预先感谢

推荐答案

对于有此问题的任何人,在通读mailx的手册页后,我都找到了帐户功能:

For anyone having this problem, after reading through the man page for mailx I found the account function:

account account1 {
set smtp=smtps://smtp.gmail.com:465
set smtp-auth=login
set smtp-auth-user=EMAIL1@gmail.com
set smtp-auth-password=PASSWORD1
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/
}

account account2 {
set smtp=smtp.office365.com:587
set smtp-use-starttls
set smtp-auth=login
set smtp-auth-user=EMAIL2@office.com
set smtp-auth-password=PASSWORD2
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/
}

这篇关于将多个SMTP电子邮件登录名添加到mailx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆