Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 18th, 2011, 05:53 PM
Registered User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Location: Buford GA
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("tjsully@bellsouth.net", "Normal TJSully");
        myMessage.To.Add(new MailAddress("tjsullivan@remax.net", "RE/MAX"));

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

    }
}

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

Last edited by tjsully; July 18th, 2011 at 05:55 PM..
Reply With Quote
  #2 (permalink)  
Old July 18th, 2011, 06:43 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
Old July 18th, 2011, 10:32 PM
Registered User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Location: Buford GA
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
Reply With Quote
  #4 (permalink)  
Old July 19th, 2011, 05:12 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #5 (permalink)  
Old July 19th, 2011, 08:49 AM
Registered User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Location: Buford GA
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
Reply With Quote
  #6 (permalink)  
Old July 19th, 2011, 09:01 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
tjsully (July 19th, 2011)
  #7 (permalink)  
Old July 23rd, 2011, 06:01 PM
Registered User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Location: Buford GA
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?
Reply With Quote
  #8 (permalink)  
Old July 23rd, 2011, 06:30 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
tjsully (July 24th, 2011)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:52 AM.


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