T
Thomas Weise
My app attempts to send eMails via SmtpClient.
This works with some addresses, but for instance a mail server hosted by
godaddy always rejects the mails.
The reply is "Relay access denied".
Does anybody have an idea what the cause of the problem is, and how I can
work around?
Thanks in advance,
Thomas
Here is my code:
Declarations:
Public Structure struMailServer
Public SMTPServer As String
Public User As String
Public PW As String
Public From As MailAddress
End Structure
Private mTo As MailAddress
Private uServerInfo As struMailServer
Code:
(uServerInfo and mTo are set by previous procedures)
Dim message As New MailMessage(uServerInfo.From, mTo)
Dim emailClient As New SmtpClient(uServerInfo.SMTPServer)
Dim SMTPUserInfo As New
System.Net.NetworkCredential(uServerInfo.User, uServerInfo.PW)
emailClient.UseDefaultCredentials = False
emailClient.Credentials = SMTPUserInfo
message.Subject = sSubject
message.Body = sBody
emailClient.Send(message)
This works with some addresses, but for instance a mail server hosted by
godaddy always rejects the mails.
The reply is "Relay access denied".
Does anybody have an idea what the cause of the problem is, and how I can
work around?
Thanks in advance,
Thomas
Here is my code:
Declarations:
Public Structure struMailServer
Public SMTPServer As String
Public User As String
Public PW As String
Public From As MailAddress
End Structure
Private mTo As MailAddress
Private uServerInfo As struMailServer
Code:
(uServerInfo and mTo are set by previous procedures)
Dim message As New MailMessage(uServerInfo.From, mTo)
Dim emailClient As New SmtpClient(uServerInfo.SMTPServer)
Dim SMTPUserInfo As New
System.Net.NetworkCredential(uServerInfo.User, uServerInfo.PW)
emailClient.UseDefaultCredentials = False
emailClient.Credentials = SMTPUserInfo
message.Subject = sSubject
message.Body = sBody
emailClient.Send(message)