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

sending mail causes exception

P: 33
I am trying to send emailes ,but it leades to exeption

the exeption message is "Failure sending mail."



Try

Dim message As New MailMessage()

message.From =New MailAddress("sujithukvl@gmail.com")

message.To.Add(New MailAddress("sujithukvl@gmail.com"))

message.Subject ="Registration"

message.BodyEncoding = System.Text.Encoding.ASCII

message.Body ="message"

message.IsBodyHtml =True

Dim client As New SmtpClient()

client.Send(message)

Label1.Text ="Email has been sent."

Catch ex As Exception

Label1.Text ="Could not send email: " + ex.Message

End Try



and in web config i have



<mailSettings>

<smtp deliveryMethod="Network">

<network defaultCredentials="true" host="localhost" port="25" />

</smtp>

</mailSettings>

Both email address are original
I am using .NET2.0

my inner exception is that "unable to connect to remote server"



Kindly help me

sujith
Apr 26 '07 #1
Share this Question
Share on Google+
1 Reply


Frinavale
Expert Mod 5K+
P: 9,731
I am trying to send emailes ,but it leades to exeption

the exeption message is "Failure sending mail."



Try

Dim message As New MailMessage()

message.From =New MailAddress("sujithukvl@gmail.com")

message.To.Add(New MailAddress("sujithukvl@gmail.com"))

message.Subject ="Registration"

message.BodyEncoding = System.Text.Encoding.ASCII

message.Body ="message"

message.IsBodyHtml =True

Dim client As New SmtpClient()

client.Send(message)

Label1.Text ="Email has been sent."

Catch ex As Exception

Label1.Text ="Could not send email: " + ex.Message

End Try



and in web config i have



<mailSettings>

<smtp deliveryMethod="Network">

<network defaultCredentials="true" host="localhost" port="25" />

</smtp>

</mailSettings>

Both email address are original
I am using .NET2.0

my inner exception is that "unable to connect to remote server"



Kindly help me

sujith
Does your email service provider require user credentials to be provided in order to send emails?

-Frinny
Apr 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.