Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2010, 04:55 AM
Authorized User
 
Join Date: Jan 2009
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Post Error The transport failed to connect to the server

Hi all

when i am sending a mail getting an Error.
The transport failed to connect to the server

Below is my code.
protected void btn1_Click(object sender, EventArgs e)
{
MailMessage msg = new MailMessage();
msg.To = txtto.Text;
msg.From = txtfrom.Text;
msg.Subject = txtsubject.Text;
msg.Body = Txtbody.Text;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(msg);
}
 
Old February 22nd, 2010, 07:17 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default

A quick google found (double check your web.config mail settings first)

Check the following:

Is a valid SMTP Server
Check to be sure the server System.Web.Mail is executing on can connect to the mail server. Some times firewalls or proxy servers can get in the way.
Try specifying the value by IP address. Poor DNS resolution can sometimes hinder name lookups.
Make sure the that the mail server is running at port 25.
If you did not specify a SmtpMail.SmtpServer property, or if SmtpMail.SmtpServer points to "localhost" (or the equivalent), be sure the SMTP Service is running on port 25.
For testing purposes change the MailMessage.From and MailMessage.To properties to an address that exists on SmtpMail.SmtpServer. Some times this exception is thrown, when it really is a relay issue.
__________________
Try our latest project www.nobanx.com Currency Exchange for members





Similar Threads
Thread Thread Starter Forum Replies Last Post
The transport failed to connect to the server. rclgoriparthi ASP.NET 2.0 Professional 2 August 26th, 2008 04:25 AM
Unable to connect. the connection failed kau_shuk VB.NET 2002/2003 Basics 0 December 29th, 2007 02:05 AM
Error Message: Asp.Net Server failed to start ... ramakrishna.one .NET Framework 2.0 0 June 9th, 2007 03:23 AM
The transport failed to connect to the server. anoophtvm ASP.NET 1.0 and 1.1 Professional 1 June 17th, 2005 07:58 AM
Sql Server Login Failed error a42 ASP.NET 1.0 and 1.1 Basics 3 December 14th, 2004 05:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.