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

You are currently viewing the ASP.NET 3.5 Professionals 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 September 17th, 2009, 09:56 AM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default failure sending e-mail (os is windows 7 and server is iis7)

the following code works well in windows xp os but in windows 7 doesn't
i have tried different ports (587,465, 25) but nevetheless it does not work. I think than problem with some configurations either in iis7 or asp.net or os etc.
please help
string host = "smtp.mail.ru";
string to = "[email protected]";
string from = "[email protected]";// от кого идет письмо
string subject ="Testing";
string body = "Testing email opportunity";
string user = "somename";// имя пользователя
string pass = "password";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient smtpClient = new SmtpClient(host, 25);
smtpClient.Credentials = new NetworkCredential(user, pass);
smtpClient.EnableSsl = true;
try
{
smtpClient.Send(message);
MessageBox.Show("Your message is delivered");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
 
Old September 17th, 2009, 10:43 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Were you using a local SMTP server on XP? If so, that may be the issue, because Win7/IIS7 doesn't include a SMTP server.

You could install a SMTP server, or even better, install a SMTP development server just for testing purposes, like Antix.

http://leedumond.com/blog/a-better-s...opment-server/
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old September 17th, 2009, 01:13 PM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

What is SMTP E-mail feature is ASp.net pane of iis manager? i thought that it could be used as SMTP server.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Failure sending mail. phuc2583 ASP.NET 3.5 Professionals 6 September 8th, 2009 08:34 PM
sending mail from sql server pady123 SQL Server 2005 0 October 17th, 2008 01:58 AM
Sending E-Mail from Local to Remote Server tact_259 Classic ASP Basics 6 April 13th, 2008 01:46 AM
IIS7, Front Page Server Extentions, Vista Bob Bedell ASP.NET 2.0 Professional 10 September 20th, 2007 12:21 PM
Failure sending email shoakat ASP.NET 2.0 Professional 1 July 4th, 2007 09:05 PM





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