By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,301 Members | 3,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,301 IT Pros & Developers. It's quick & easy.

SMTP Authentication problem

P: n/a
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("me@mydomain.co.uk", "Me")
Message.To.Add(New MailAddress("yo*@mydomain.co.uk", "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>
Jun 27 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

--
MAdhur

"eruth" <em***********@gmail.comwrote in message
news:cf**********************************@34g2000h sh.googlegroups.com...
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("me@mydomain.co.uk", "Me")
Message.To.Add(New MailAddress("yo*@mydomain.co.uk", "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>
Jun 27 '08 #2

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

On May 12, 7:08 pm, "Madhur" <s...@df.comwrote:
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.

--
MAdhur

"eruth" <emma.pearl...@gmail.comwrote in message

news:cf**********************************@34g2000h sh.googlegroups.com...
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("m...@mydomain.co.uk", "Me")
Message.To.Add(New MailAddress("y...@mydomain.co.uk", "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>
Jun 27 '08 #3

P: n/a
Check if your authentication requires some security encryption.

"eruth" <em***********@gmail.comwrote in message
news:67**********************************@m73g2000 hsh.googlegroups.com...
If authentication is turned off, the mail can be sent, but as soon as
we turn it back on, I get that message.

On May 12, 7:08 pm, "Madhur" <s...@df.comwrote:
>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.

--
MAdhur

"eruth" <emma.pearl...@gmail.comwrote in message

news:cf**********************************@34g2000 hsh.googlegroups.com...
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("m...@mydomain.co.uk", "Me")
Message.To.Add(New MailAddress("y...@mydomain.co.uk", "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>
Jun 27 '08 #4

P: n/a
On May 13, 1:36 pm, "Madhur" <s...@df.comwrote:
Check if your authentication requires some security encryption.

"eruth" <emma.pearl...@gmail.comwrote in message

news:67**********************************@m73g2000 hsh.googlegroups.com...
If authentication is turned off, the mail can be sent, but as soon as
we turn it back on, I get that message.
On May 12, 7:08 pm, "Madhur" <s...@df.comwrote:
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.
--
MAdhur
"eruth" <emma.pearl...@gmail.comwrote in message
>news:cf**********************************@34g2000 hsh.googlegroups.com...
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("m...@mydomain.co.uk", "Me")
Message.To.Add(New MailAddress("y...@mydomain.co.uk", "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>
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 ;)
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.