Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 July 18th, 2011, 05:53 PM
Registered User
 
Join Date: Jul 2011
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default Struggling with Ch 9 sending e-mail

I'm using the same settings as I have in Outlook. I get the following error in the details of errors. I get no compile errors but it bombs out on the mySmtpClient.Send(myMessage); statement and falls into the debugger.

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

My code is as follows, I used * for my password, I have the password correct in my code:

Code:
public partial class Demos_EMailDemo : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        MailMessage myMessage = new MailMessage();
        myMessage.Subject = "Tim's Test e-mail from an ASP page";
        myMessage.Body = "Hello world, here is the mail message message ";
        myMessage.From = new MailAddress("[email protected]", "Normal TJSully");
        myMessage.To.Add(new MailAddress("[email protected]", "RE/MAX"));

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

    }
}

In the Web.config
 <system.net>
        <mailSettings>
            <smtp deliveryMethod ="Network"
                  from="TimmyS &lt;[email protected]&gt;">
                <network enableSsl="true" userName="[email protected]" password="**********" host="smtp.att.yahoo.com" port="465" />
            </smtp>                     
        </mailSettings>
    </system.net>

Last edited by tjsully; July 18th, 2011 at 05:55 PM..
 
Old July 18th, 2011, 06:43 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,

Does Yahoo allow you to use your Bellsouth account?

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 July 18th, 2011, 10:32 PM
Registered User
 
Join Date: Jul 2011
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default yahoo

Not sure, haven't tried yahoo. I do however have have a gmail account I should try. I assumming you didn't see anything in the code that was incorrect??? My assumption was a coding error
 
Old July 19th, 2011, 05:12 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No, the code looks fine to me. It must be something with the SMTP settings in web.config.

A few things to check:

1. The port number that Yahoo uses
2. The user name and password that Yahoo requires.
3. Whether or not Yahoo uses SSL

And yes, Gmail would work as well. For the Gmail settings, take a look at this post:

http://imar.spaanjaars.com/505/using...at-require-ssl

And finally, if you just want to continue, you could also drop the mail on your local disk as explained in the book.

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!
 
Old July 19th, 2011, 08:49 AM
Registered User
 
Join Date: Jul 2011
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Thumbs up Thanx

Will try my G-Mail account this afternoon, seems I remember having trouble using my Bellsouth aqccounbg on my phone, I can receive but not send. The solution was to use GMail for sending. It could be the same issue.

As to sending the e-mail to a folder, can't do that it would be embarissing if I can't figure this out. I had a 20 year career in IT as a programer / developer/ manager & department head and am trying to get back into the field, been in Real Estate for the last 7 years. If I can't get something this elementary to work I mught as well go and apply to Wal-Mart
 
Old July 19th, 2011, 09:01 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I
Quote:
remember having trouble using my Bellsouth aqccounbg on my phone
The Yahoo outgoing SMTP needs authentication so you'll need to supply it with a user name and password it likes.

Quote:
As to sending the e-mail to a folder, can't do that it would be embarissing if I can't figure this out.
I see what you mean.... You can definitely make it work; it's just a matter of finding the right combination of mail server, port, user name and password.

Good luck.

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!
The Following User Says Thank You to Imar For This Useful Post:
tjsully (July 19th, 2011)
 
Old July 23rd, 2011, 06:01 PM
Registered User
 
Join Date: Jul 2011
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default Got it working!

Apparently it is something with Bellsouth (AT&T now) that prevents one from using their SMTP servers, don't know how but I know I canot send e-mail from my phone, just receive, but have no problem from my Laptop. Anyway it works with my G-Mail account. Does the specific order of the elements in the Network tag make any difference?
 
Old July 23rd, 2011, 06:30 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No, the order doesn't matter. Internally, the config settings are read from the config file and assigned to a configuration object once. The initial order of nodes and attributes has no effect on the final configuration object.

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!
The Following User Says Thank You to Imar For This Useful Post:
tjsully (July 24th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
problems sending mail with java mail gandacuboy J2EE 2 December 20th, 2006 03:05 PM
sending mail hastikeyvan ASP.NET 2.0 Professional 2 June 15th, 2006 12:24 AM
sending mail ashokparchuri General .NET 3 May 5th, 2005 02:42 AM
Sending e-mail to different mail box! Calibus Classic ASP Databases 4 September 3rd, 2004 05:48 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





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