Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
//Name Space:
using System.Web.Mail;

//Btn click:

MailMessage mail = new MailMessage();
mail.To = "user@gmail.com";
mail.From = "admin@admin.com";
mail.Subject = "Confirmation";
mail.Body = "Acoount confirmed....................";
SmtpMail.SmtpServer = "1:1:2:1";

try
{
  SmtpMail.Send(mail);
  Response.Write("Mail send successfully");
}
catch (Exception ex)
{
  Response.Write("sending failure:  "+ex.Message);
}

I wrote this code for sending mail in asp.net c# script. But an error has occured.
error is:

The transport failed to connect to the server

What is the reason for this error? I don't understand what is the correct problem of this error
Posted
Updated 25-Jan-11 18:32pm
v2
Comments
JF2015 26-Jan-11 0:32am    
Edited to add code formatting.
Sandeep Mewara 26-Jan-11 3:42am    
This is what some 7th time you are posting on the same?
thatraja 26-Jan-11 10:22am    
/*This is what some 7th time you are posting on the same?*/
Great chasing sandeep ;)
Sandeep Mewara 26-Jan-11 10:46am    
:)

1 solution

Did you notice: this is not a valid address: "1:1:2:1"?
 
Share this answer
 
Comments
JF2015 26-Jan-11 0:53am    
Good find. I didn't see that ;)
Sergey Alexandrovich Kryukov 26-Jan-11 1:05am    
OP commented:

"Already I wrote the correct valid address in my code page, just a sample for this address: "1:1:2:1""
Sergey Alexandrovich Kryukov 26-Jan-11 1:06am    
I'm confused: did it solved your problem?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900