我正在尝试使用Gmail-API发送电子邮件,但收到Insufficient Permission
。这是我的代码:
var msg = new AE.Net.Mail.MailMessage
{
Subject = "[ENC] " + textBox2.Text,
From = [MyEmailHere],
Body = textBox6.Text
};
msg.To.Add(new MailAddress(textBox1.Text));
msg.ReplyTo.Add(msg.From);
var msgStr = MimeMessage.CreateFromMailMessage(msg);
var gmailMessage = new Google.Apis.Gmail.v1.Data.Message
{
Raw = Base64UrlEncode(msgStr.ToString())
};
UsersResource.MessagesResource.SendRequest request = service.Users.Messages.Send(gmailMessage, "me");
request.Execute();
异常出现在最后一行。
我的示例RAW发送:
RnJvbTogcHBhbmFraW5AZ21haWwuY29tDQpSZXBseS1UbzogcHBhbmFraW5AZ21haWwuY29tDQpUbzogcHBhbmFraW5AZ21haWwuY29tDQpTdWJqZWN0OiBbRU5DXSBhZGRzDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCg0Kw6_Cv8K9PcOvwr_CvVrDr8K_wr0Jw6_Cv8K9w4LCtMOvwr_CvTobF8Ovwr_CvTw
其他问题:如何从凭据或授权中获取我的电子邮件地址?