SMTP Authentication problem

E

eruth

Hi all,

I'm trying to send an e-mail from a vb.net web form. I can create the
message, but when it comes to actually sending it I get the following
error. "Mailbox name not allowed. The server response was: Server
policy dictates you must authenticate first "

So far as I can tell, my code is doing what it's meant to, but I'd
appreciate someone casting an eye over it to make sure. This is based
on a couple of examples found through google.
<code>
Dim Message As MailMessage = New MailMessage()
Dim Smtp As New SmtpClient()
Dim SmtpUser As New System.Net.NetworkCredential()
'-- Build Message
Message.From = New MailAddress("(e-mail address removed)", "Me")
Message.To.Add(New MailAddress("(e-mail address removed)", "you"))
Message.IsBodyHtml = False
Message.Subject = "test"
Message.Body = "This is a test"
'-- Define Authenticated User
SmtpUser.UserName = "user"
SmtpUser.Password = "password"
SmtpUser.Domain = "mydomain.co.uk"
'-- Send Message
Smtp.UseDefaultCredentials = False
Smtp.Credentials = SmtpUser
Smtp.Host = "mydomain.co.uk"
Smtp.Port = 25
Smtp.DeliveryMethod = SmtpDeliveryMethod.Network
Smtp.Send(Message)
</code>
 
M

Madhur

The error message suggests that mydomain.co.uk is asking for SMTP
authentication.

Are you sure that particular SMTP can relay email messages without
authentication.
 
E

eruth

If authentication is turned off, the mail can be sent, but as soon as
we turn it back on, I get that message.
 
E

eruth

Check if your authentication requires some security encryption.

Turns out all this was caused not by my code, but by the SMTP server
not being configured correctly. Nice to know it wasn't me though ;)
 

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

Similar Threads


Members online

Forum statistics

Threads
473,787
Messages
2,569,627
Members
45,328
Latest member
66Teonna9

Latest Threads

Top