通过 SMTP 代表用户发送电子邮件?

Sending email on behalf of user via SMTP?

我正在构建一个允许我的用户发送电子邮件的应用程序。我希望电子邮件来自他们的域。目前,电子邮件是代表我的 Mandrill 帐户发送的,其 name/email 用于发件人 header。它 "works" 但大部分邮件没有像我想象的那样送达。

在我看来,一种选择是使用 Mandrill、Mailgun、Sendgrid 等服务,让我的用户在那里更新 TXT 记录以验证他们的域,从而允许我代表我的用户发送。对吗?

我想知道是否还有另一种选择是收集 SMTP 凭据,然后通过 SMTP 为我的用户发送消息,从而避免我的用户在使用我的应用程序发送之前必须登录并更新他们的 TXT 记录消息。我认为简单地添加 SMTP 凭据会容易得多。这可能吗?

"The way I see it, one option is to use a service like Mandrill, Mailgun, Sendgrid, etc and have my users update there TXT records to verify their domains, thus allowing me to send on behalf of my users. Is that correct?"

正确的是,您希望他们至少有一个 SPF 记录,表明您使用的服务被允许为该域发送电子邮件。 IE。 TXT v=spf1 +a +mx inlcude:sendgrid.net ~all

"I'm wondering if another option would be to collect SMTP credentials, and then send the message via SMTP for my user, thereby preventing my user from having to log in and update their TXT records before using my app to send messages. I think it would be far easier to simply add SMTP credentials. Is this possible?"

不是真的。他们需要确保他们的 DNS 记录至少有一个有效的 SPF (TXT) 记录,否则主要的电子邮件提供商和播放器将丢弃他们的消息或将它们标记为 SPAM/junk。