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

Trouble sending email with ASP.NET 2.0

P: n/a
I have an ASP.NET 2.0 application that is supposed to send an email after a
certain form is submitted. When it tries to send the email, I receive the
following error:
Transaction failed. The server response was: nj********@hotmail.com:
Recipient address rejected: Access denied
(in the error message, the part with the email address was displayed as
<myemailaddress>, but you will probably see a link because our news viewers
think they know what we want). I know that the address is correct, so what
is it that the server didn't like about it? Is it saying I don't have
permission to use the SMTP server (I was pretty sure I was, but this is the
first time I am sending email from this server)? Is there something wrong
with my code? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Jan 5 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, 5 Jan 2007 03:55:44 -0500, "Nathan Sokalski"
<nj********@hotmail.comwrote:
Is there something wrong
with my code? Any help would be appreciated. Thanks.
You didn't provide your code, so it is hard to tell.

However, this works for me:

Try
Dim mail As New Mail.MailMessage()

mail.From = New Mail.MailAddress("ma**@mail.somewhere",
"Subject")
mail.To.Add("an*****@mail.somewhere")

mail.Subject = "Subject"
mail.Body = "Body"

Dim smtp As New Mail.SmtpClient("mail.planprojekt.dk")
smtp.Credentials = New
NetworkCredential("ma**@mail.somewhere", "password")
smtp.Send(mail)

bEmailSent = True
Catch ex As Exception
Exit Sub
End Try
/Snedker
Jan 5 '07 #2

P: n/a
The code I am using is as follows:
Private Sub SendEmailNotification()
Dim confsender As New
SmtpClient(System.Configuration.ConfigurationManag er.AppSettings("smtpserver"))
Dim confirmation As New MailMessage()
confirmation.IsBodyHtml = False
confirmation.From = New MailAddress("fr*********@mydomain.com")
confirmation.To.Add("nj********@hotmail.com")
confirmation.Subject = "My Subject"
confirmation.Body = "My Body"

confsender.Send(confirmation)
End Sub
Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
"Morten Snedker" <morten_spammenot_ATdbconsult.dkwrote in message
news:2p********************************@4ax.com...
On Fri, 5 Jan 2007 03:55:44 -0500, "Nathan Sokalski"
<nj********@hotmail.comwrote:
>Is there something wrong
with my code? Any help would be appreciated. Thanks.

You didn't provide your code, so it is hard to tell.

However, this works for me:

Try
Dim mail As New Mail.MailMessage()

mail.From = New Mail.MailAddress("ma**@mail.somewhere",
"Subject")
mail.To.Add("an*****@mail.somewhere")

mail.Subject = "Subject"
mail.Body = "Body"

Dim smtp As New Mail.SmtpClient("mail.planprojekt.dk")
smtp.Credentials = New
NetworkCredential("ma**@mail.somewhere", "password")
smtp.Send(mail)

bEmailSent = True
Catch ex As Exception
Exit Sub
End Try
/Snedker

Jan 5 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.