473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

sending mail causes exception

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
1 1463
Frinavale
9,735 Expert Mod 8TB
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

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

Similar topics

3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
2
by: HK | last post by:
In VB.NET, I'm getting the exception "failure sending mail". I'm running VS 2005 on XP Home. This is a new install on a new PC. I've never had email problems with VS 2003, and there I could...
6
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
7
by: Ray Booysen | last post by:
Hi all I'm sending email via ASP.NET in HTML mode. Each email has exactly one attachment and I do have full access to the SMTP server. However, if I send the email in HTML format, the...
2
by: satnamsarai | last post by:
Using System.Net.Mail: Sometimes I get error 'failure sending mail. Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.' Not sure how...
2
by: Danny | last post by:
Hi all, Trying to send mail with System.Net.SmtpClient, using very simple code just for testing: SmtpClient smtp = new SmtpClient("mail.server.com", 25); smtp.Credentials = new...
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.