Cannot send eMails

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)
 
M

Mr. Arnold

Thomas Weise said:
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?

The SMTP relay server is simply blocking e-mails sent to that address. I
don't know if you're trying to do this through a company LAN or you're going
through your ISP. But it's being blocked.
 
T

Thomas Weise

Andrew,
Thanks for your help. On investigating by using Outlook as client on the
same mail server, I found that I probably have selected a too long password
when setting up the account...
Thomas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top