为何从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");
}