阻止邮件保存在“已发送邮件”文件夹中

时间:2019-03-28 15:37:32

标签: vb.net system.net.mail

“我的Office 365已发送邮件”文件夹包含我的网站根据访问者的请求发送的大量邮件副本。 我不知道System.Net.Mail.MailMessage是否具有防止邮件将副本保存在“已发送邮件”文件夹中的任何选项,类似于Outlook的“不保存”功能。

这是我的电子邮件代码(注释了我的请求):

Private Sub SendSimpleMail(MailServerUrl As String, username As String, password As String, From As String, [to] As String, subject As String, body As String)
    Dim oSmtpClient As SmtpClient = New System.Net.Mail.SmtpClient(MailServerUrl)
    oSmtpClient.UseDefaultCredentials = False
    oSmtpClient.Credentials = New System.Net.NetworkCredential(username, password)

    Dim oMessage As New System.Net.Mail.MailMessage(From, [to])
    oMessage.Subject = subject
    oMessage.SubjectEncoding = System.Text.Encoding.UTF8
    oMessage.Body = body
    oMessage.BodyEncoding = System.Text.Encoding.UTF8
    oMessage.IsBodyHtml = True

    ' oMessage.DoNotSave = true 

    oSmtpClient.Send(oMessage)
End Sub

0 个答案:

没有答案