首页 > 解决方案 > 发送电子邮件时也在我的收件箱中收到电子邮件

问题描述

为什么从 Gmail API 发送电子邮件时,会向提供的电子邮件地址发送一封电子邮件,但我的收件箱中也收到了电子邮件?

public ActionResult NewEmail(String from, String text, string To, string sub)
{
    GmailService service = GmailServSendMail();
    string plainText = "To:" + To + "," + from + "\r\n" + "Subject:" + sub + "\r\n" + "Content-Type: text/html; charset=us-ascii\r\n\r\n" + text;
    var newMsg = new Google.Apis.Gmail.v1.Data.Message();
    newMsg.Raw = Base64UrlEncode(plainText.ToString());
    List<string> labe = new List<string>();
    labe.Add("SENT");
    newMsg.LabelIds = labe;
    service.Users.Messages.Send(newMsg, "me").Execute();
    return View("Email");
}

标签: c#gmail-api

解决方案


推荐阅读