 |
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
|
|
|
|
|

July 18th, 2011, 05:53 PM
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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 <[email protected]>">
<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..
|
|

July 18th, 2011, 06:43 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Does Yahoo allow you to use your Bellsouth account?
Imar
|
|

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

July 19th, 2011, 05:12 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

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

July 19th, 2011, 09:01 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

July 23rd, 2011, 06:01 PM
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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?
|
|

July 23rd, 2011, 06:30 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|
 |
|