Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 28th, 2009, 09:41 PM
Authorized User
 
Join Date: Sep 2009
Posts: 35
Thanks: 6
Thanked 1 Time in 1 Post
Default Chapter 9 Trying to send email out

Hello Imar,

Great book, I am just having a slight issue in chapter 9 and I think I might have an idea as to what is going on but I'd appreciate it if you could provide any more insight.

I am getting this error when I try to run the page in my web browser:

"
Server Error in '/Site' Application.
--------------------------------------------------------------------------------

No connection could be made because the target machine actively refused it 74.125.65.109:25
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 74.125.65.109:25

Source Error:


Line 11:
Line 12: Dim mySmtpClient As New SmtpClient()
Line 13: mySmtpClient.Send(myMessage)
Line 14: End Sub
Line 15: End Class
"

Now I'm running this at a work computer and I'm assuming maybe something is being blocked in the firewall? Do you have any idea why this is getting thrown in the browser?

Thanks again
 
Old September 29th, 2009, 06:22 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at the error message:
Quote:
No connection could be made because the target machine actively refused it 74.125.65.109:25
It's not your computer that's blocking something, but the target machine (e.g. the mail server).

Maybe that IP address is from your home ISP and is not accessible from your work network?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old March 3rd, 2011, 11:01 AM
Registered User
 
Join Date: Mar 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Chapter 9 Asp.net 3.5, Email problem Please "Help"

Hi Imar,
Great book and am using for my final year project.
I am badly stuck! and My head is spinning Now


Couldn't make the send email thing work getting an error

"......... The server response was: 5.7.0 Must issue a STARTTLS command first"

Line 25:
Line 26: SmtpClient mySmtpClient = new SmtpClient();
Line 27: mySmtpClient.Send(myMessage);
Line 28: mySmtpClient.EnableSsl = true;
Line 29:

******************
My Email.aspx as follows:
******************

MailMessage myMessage = new MailMessage();
myMessage.Subject = "Test Message";
myMessage.Body = "Hello world, from Planet Wrox";

myMessage.From = new MailAddress("[email protected]", "Waqas");
myMessage.To.Add(new MailAddress("[email protected]", " SendToWaqas"));

SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);
mySmtpClient.EnableSsl = true;

********************
And web.config as follows:
********************

<system.net>
<mailSettings>

<smtp deliveryMethod="Network" from="Waqqas Basit &lt;[email protected]&gt;">
<network host="smtp.live.com" userName="[email protected]" password= "xyxyxyx" port="25" />
</smtp>

</mailSettings>
</system.net>

__________________________________________________ _____________________________________

Please help as it's the 2nd day since i am in front of the computer with result = 0 and have tried my different email accounts with different smtp servers.

Any help much apprecited

Regards
Waqas
 
Old March 3rd, 2011, 10:40 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at this:

Quote:
"......... The server response was: 5.7.0 Must issue a STARTTLS command first"
and then this:

Code:
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);
mySmtpClient.EnableSsl = true;
You're setting the SSL setting after you've sent the message.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old March 4th, 2011, 05:45 AM
Registered User
 
Join Date: Mar 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 9 Email problem STARTTLS command first solved and working

Morning Imar,

Thank you very much.

I can't believe i never realised that and i should have written the

line:
mySmtpClient.EnableSsl = true;

before

line:
mySmtpClient.Send(myMessage);

It' s working great now and i can work ahead now on the book.

Once again great book and thanks for your feedback on my query.

Regards

Waqqas Basit
 
Old March 5th, 2011, 05:33 AM
Registered User
 
Join Date: Dec 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default text file not being replaced

Code:
      
        mailBody = mailBody.Replace("##Name##", Name.Text);
        mailBody = mailBody.Replace("##Email##", EmailAddress.Text);
        mailBody = mailBody.Replace("##HomePhone##", PhoneHome.Text);
        mailBody = mailBody.Replace("##BusinessPhone##", PhoneBusiness.Text);
        mailBody = mailBody.Replace("##Comments##", Comments.Text);
nothing is shown in place of the text entered in the text boxes
 
Old March 5th, 2011, 05:42 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi papimann

Please don't cross-post and continue the discussion at your original thread.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
send email phuc2583 ASP.NET 2.0 Professional 2 April 14th, 2009 10:07 AM
Need to send email garrettbrennan Visual C++ 0 September 13th, 2007 12:24 PM
How to send email abiye49 Excel VBA 1 January 10th, 2007 03:32 PM
Send by email tsimsha Classic ASP Databases 1 October 1st, 2005 03:03 AM
send email X-Ken VS.NET 2002/2003 8 July 2nd, 2004 06:13 AM





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