以下是代码:
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
Dim attachment As System.Net.Mail.Attachment
SmtpServer.Credentials = New _
Net.NetworkCredential("administrator@company.com", "1234")
SmtpServer.Port = 25
SmtpServer.Host = "SmtpServer"
mail = New MailMessage()
mail.From = New MailAddress("user@company.com.my")
mail.To.Add("recipient@external.com")
mail.CC.Add("user1@company.com")
mail.CC.Add("user2@company.com")
mail.Headers.Add("Disposition-Notification-To", "user1@company.com") 'Read receipt
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure 'Fail delivery notification
mail.Subject = "Sending Documents"
mail.Body = "To Whom May Concern," & vbCrLf _
& vbCrLf & "Please refer to the attachment for the documents." & vbCrLf & _
"NOTE : This is an automatically generated email and will be sent daily."
For Each path As String In attch
attachment = New System.Net.Mail.Attachment(path)
mail.Attachments.Add(attachment)
Next
Try
SmtpServer.Send(mail)
SmtpServer = Nothing
Catch ex As Exception
Response.Write(ex.ToString)
Exit Sub
End Try
问题只是内部电子邮件接收,而不是外部电子邮件。 代码执行期间未显示任何错误。 关于如何解决这个问题的任何想法? 或者我是否需要在Microsoft Exchange Server上配置某些内容? 服务器也使用MailMarshal进行过滤。 感谢您提供的反馈意见。
答案 0 :(得分:0)
确保“mail.From”值位于SMTP服务器允许的列表中。可能是不允许中继。