여기

2012-06-20 4 views
0

은 실패 코드이다 :여기

Dim SmtpServer As New SmtpClient() 
    Dim mail As New MailMessage() 
    Dim attachment As System.Net.Mail.Attachment 

    SmtpServer.Credentials = New _ 
    Net.NetworkCredential("[email protected]", "1234")  
    SmtpServer.Port = 25 
    SmtpServer.Host = "SmtpServer" 

    mail = New MailMessage() 
    mail.From = New MailAddress("[email protected]") 

    mail.To.Add("[email protected]") 

    mail.CC.Add("[email protected]") 
    mail.CC.Add("[email protected]") 

    mail.Headers.Add("Disposition-Notification-To", "[email protected]") '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

스팸 메일/필터와 교환 로그를 모두 확인했다고 가정 할 수 있습니다 (바운스 백 등) – Kane

답변

0

"mail.From"값이 SMTP 서버에서 허용하는 목록에 있는지 확인하십시오. 중계가 허용되지 않을 수도 있습니다.