相关疑难解决方法(0)

GMail API电子邮件弹跳

在.Net中使用GMail API.使用Net.Mail.MailMessage创建消息传递.然后使用MimeKit创建MimeMessage(使用此方法发送附件+ HTML消息).将MimeMessage.ToString传递给Base64编码器.没有API错误.代码运行正常.我可以在GMail的已发送页面中看到该消息.邮件看起来很完美(发送实际返回消息ID).但是,Gmail中的此邮件会附加以下附加消息.

Bounce <nobody@gmail.com>

An error occurred. Your message was not sent.
Run Code Online (Sandbox Code Playgroud)

像往常一样,谷歌没有其他信息.如何解决这个问题?

        Dim msg = New Net.Mail.MailMessage
        msg.Subject = subject
        msg.To.Add(New MailAddress(ToEmail))
        msg.From = New MailAddress(FromEmail, SenderName)
        msg.ReplyTo = New MailAddress(FromEmail, SenderName)
        msg.Body = bodyText
        msg.IsBodyHtml = True

        If Not String.IsNullOrWhiteSpace(fileAttachment) Then
            If System.IO.File.Exists(fileAttachment) Then
                Dim Attachment As New Net.Mail.Attachment(fileAttachment, "application/pdf")
                msg.Attachments.Add(Attachment)
            End If
        End If
       Dim message As MimeMessage = MimeMessage.CreateFromMailMessage(msg)
       Dim newMsg = New Google.Apis.Gmail.v1.Data.Message()
       newMsg.Raw = Base64UrlEncode(message.ToString)
       GmailService.Users.Messages.Send(newMsg, "me").Execute()



Private Function Base64UrlEncode(ByVal input As String) …
Run Code Online (Sandbox Code Playgroud)

gmail-api

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

gmail-api ×1