简体   繁体   English

如何从 SendGrid 转发电子邮件

[英]How to forward emails from SendGrid

Overview:概述:

Our use case involves using the SendGrid Inbound Parse to accept, record and process emails.我们的用例涉及使用 SendGrid Inbound Parse 来接受、记录和处理电子邮件。 We also need those emails to be forwarded to our ticketing system (ie Zoho Desk).我们还需要将这些电子邮件转发到我们的票务系统(即 Zoho Desk)。

We would really like to be able to forward the unedited email to Zoho Desk, preserving the original From, To, etc.我们非常希望能够将未经编辑的电子邮件转发到 Zoho Desk,保留原始发件人、收件人等。

Problem(s):问题):

When we try to forward the email using SendGrid's SMTP server, and using the MimeKit.MimeMessage.ResentTo("emailchannel@account.zohodesk.com") option, SendGrid is rejecting the forward request because of "Sender Authentication".当我们尝试使用 SendGrid 的 SMTP 服务器并使用 MimeKit.MimeMessage.ResentTo("emailchannel@account.zohodesk.com") 选项转发电子邮件时,SendGrid 由于“发件人身份验证”而拒绝转发请求。 The error we're getting from SendGrid is:我们从 SendGrid 得到的错误是:

The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements.

Below is the code we're using:下面是我们使用的代码:

SmtpClient cli = new SmtpClient();
cli.Connect(_config["SendGrid:Server"], int.Parse(_config["SendGrid:Port"]), true);
cli.Authenticate(_config["SendGrid:Username"],_config["SendGrid:ApiKey"]);

message.ResentSender = null;
message.ResentFrom.Clear();
message.ResentReplyTo.Clear();
message.ResentTo.Clear();
message.ResentCc.Clear();
message.ResentBcc.Clear();

message.ResentFrom.Add(MailboxAddress.Parse(_config["SendGrid:From"]));
message.ResentReplyTo.AddRange(message.ResentFrom);

message.ResentTo.AddRange(from o in matches
                          select MailboxAddress.Parse((string)o.ticket_addr));

message.ResentMessageId = MimeUtils.GenerateMessageId();
message.ResentDate = DateTimeOffset.Now;

cli.Send(message);

Question(s):问题):

  1. Is there a way with SendGrid we can forward the inbound email to Zoho Desk while preserving the From fields?我们可以使用 SendGrid 将入站电子邮件转发到 Zoho Desk,同时保留发件人字段吗?
  2. I would imagine SendGrid isn't the only company requiring Sender Authentication, as such, how else can we forward unedited emails to a ticketing platform?我想 SendGrid 不是唯一需要发件人身份验证的公司,因此,我们如何才能将未经编辑的电子邮件转发到票务平台?

Twilio SendGrid developer evangelist here. Twilio SendGrid 开发人员布道者在这里。

SendGrid does require you to verify, via Single Sender Verification or Domain Authentication , email addresses from which you wish to send emails. SendGrid 确实要求您通过 单一发件人验证域身份验证来验证您希望从中发送电子邮件的电子邮件地址。 So you cannot use SendGrid to automatically forward keeping the from email intact.所以你不能使用 SendGrid 自动转发保持来自电子邮件的完整。

I have a couple of ideas about workarounds here though.不过,我对这里的解决方法有一些想法。

You could forward from your verified email address and add the original from email address in a reply-to field.您可以从经过验证的电子邮件地址转发,并在回复字段中添加原始电子邮件地址。 I haven't worked with Zoho Desk, but perhaps you could configure it to respect that field instead of from.我没有使用过 Zoho Desk,但也许您可以将其配置为尊重该领域而不是 from。

Zoho has a guide on how to set up forwarding from various inboxes . Zoho 有关于如何从各种收件箱设置转发指南 Could you host your email with one of those providers and forward incoming emails onto Zoho and to your SendGrid email address for this processing?您能否将您的电子邮件托管在其中一个提供商处,并将收到的电子邮件转发到 Zoho 和您的 SendGrid 电子邮件地址以进行此处理?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM