Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
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 August 31st, 2011, 11:16 AM
Authorized User
 
Join Date: Apr 2011
Posts: 11
Thanks: 4
Thanked 0 Times in 0 Posts
Default Problem sending E-mail Message (ch. 9 p. 319)

The title says it all. I have checked everything. I have AT&T DSL, i know my user name and password. At&t does require SSL, so I enabled that, I have the correct port # for outgoing messages. Everything seems to be find, the only concern I have is the host name. On the at&t site I linked below, it says the outgoing smtp is outbound.att.net . The book always reverences it as smtp.yourprovider.net and not that there could be a outgoing. in front of the provider. Regardless I get errors either way.

I changed my password and e-mail address for privacy reasons, but I checked both the incoming and outcoming several times, they re correct valid.

Link to At&t site : http://www.att.com/esupport/article....id=3KDdTsPEBp2

my web.config file:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<pages theme="Monochrome">
<controls>
<add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx" />
</controls>
</pages>
<compilation debug="true" targetFramework="4.0"/>
</system.web>

<system.net>
<mailSettings>
<smtp deliveryMethod="Network"
from="Brandon Grunwell &lt;[email protected]&gt;">
<network enableSsl="true" userName="[email protected]" password="correctpassword" port="465" host="smpt.outbound.att.net"/>
</smtp>
</mailSettings>
</system.net>
</configuration>

Email.aspx file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

public partial class Demos_Email : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
MailMessage myMessage = new MailMessage();
myMessage.Subject = "Test Message";
myMessage.Body = "Hello world, from Planet Wrox";
myMessage.From = new MailAddress("[email protected]", "Brandon Grunwell");
myMessage.To.Add(new MailAddress("[email protected]", "Clem"));

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

error message in browser:

Server Error in '/' Application.

The remote name could not be resolved: 'smpt.outgoing.att.net'

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.WebException: The remote name could not be resolved: 'smpt.outgoing.att.net'

Source Error:


Line 18:
Line 19: SmtpClient mySmtpClient = new SmtpClient();
Line 20: mySmtpClient.Send(myMessage);
Line 21: }
Line 22: }

Source File: c:\BegASPNET\Site\Demos\Email.aspx.cs Line: 20

Stack Trace:


[WebException: The remote name could not be resolved: 'smpt.outgoing.att.net']
System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +6127328
System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +314
System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +322
System.Net.Mail.SmtpConnection.GetConnection(Servi cePoint servicePoint) +146
System.Net.Mail.SmtpTransport.GetConnection(Servic ePoint servicePoint) +222
System.Net.Mail.SmtpClient.GetConnection() +50
System.Net.Mail.SmtpClient.Send(MailMessage message) +1496

[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +1829
Demos_Email.Page_Load(Object sender, EventArgs e) in c:\BegASPNET\Site\Demos\Email.aspx.cs:20
System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225

The error message in the browser leads me to believe that the smpt.outgoing.att.net is not correct. I have tried several variations,m including just using smpt.att.net or just outgoing.att.net with no .smpt in from of it, smpt.outgoing.yahoo.att.net and smpt.yahoo.att.net since the att tech guy initially had me log in to my att email via att.yahoo.com.

...help, please
 
Old August 31st, 2011, 03:14 PM
Authorized User
 
Join Date: Apr 2011
Posts: 11
Thanks: 4
Thanked 0 Times in 0 Posts
Default

now getting this error:
An existing connection was forcibly closed by the remote host

didn't really change anything. Tried a few different server address I found on the internet that I though may work. Even if you don't know the solution, if anyone could expliane any bit of this they do understand it would be greatful. This is the only area I've some across so far that the book does not give enough information about
 
Old August 31st, 2011, 04:31 PM
Registered User
 
Join Date: Aug 2011
Posts: 13
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Quote:
Originally Posted by BGrun08 View Post
The error message in the browser leads me to believe that the smpt.outgoing.att.net is not correct. I have tried several variations,m including just using smpt.att.net or just outgoing.att.net with no .smpt in from of it, smpt.outgoing.yahoo.att.net and smpt.yahoo.att.net since the att tech guy initially had me log in to my att email via att.yahoo.com.

...help, please
It's SMTP, not SMPT. Simple Mail Transfer Protocol.
 
Old August 31st, 2011, 04:34 PM
Authorized User
 
Join Date: Apr 2011
Posts: 11
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by mmmason View Post
It's SMTP, not SMPT. Simple Mail Transfer Protocol.
Yeah, I mis-typed in the bottom of my forum post...but if you look at my code you see i have smtp written everywhere it needs to be. So thanks for trying...I wish it were that easy, lol. But aside from the mistakes at the bottom of my forum post, I have combed the code for errors and can't find any....including putting smpt instead of smtp
 
Old August 31st, 2011, 04:48 PM
Registered User
 
Join Date: Aug 2011
Posts: 13
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Quote:
Originally Posted by BGrun08 View Post
Yeah, I mis-typed in the bottom of my forum post...but if you look at my code you see i have smtp written everywhere it needs to be. So thanks for trying...I wish it were that easy, lol. But aside from the mistakes at the bottom of my forum post, I have combed the code for errors and can't find any....including putting smpt instead of smtp
This snippet from dump you included in the first post suggests otherwise:-

<system.net>
<mailSettings>
<smtp deliveryMethod="Network"
from="Brandon Grunwell &lt;[email protected]&gt;">
<network enableSsl="true" userName="[email protected]" password="correctpassword" port="465" host="
smpt.outbound.att.net"/>
</smtp>
</mailSettings>
</system.net>


And a bit further down:-

Source File: c:\BegASPNET\Site\Demos\Email.aspx.cs Line: 20
Stack Trace:
[WebException: The remote name could not be resolved:
'smpt.outgoing.att.net']
 
Old August 31st, 2011, 06:26 PM
Authorized User
 
Join Date: Apr 2011
Posts: 11
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thanks for pointing that out...I thought u were just referring the my comments at the bottom where i put 'smpt" like 6 times, not the time in the code. I knew that was not the problem so I dis-missed it, but I appreciate you going through the code and finding that error. Even when i have smpt.outgoing.att.net it doesn't work. I had changed that value 1000 times before posting, 999 of them with smtp, so I knew that was not the problem . I have, however, found an SMTP server address that MIGHT work. when I use astp.att.yahoo.com I get this error in the web browser :

Server Error in '/' Application.

An existing connection was forcibly closed by the remote host

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: An existing connection was forcibly closed by the remote host

Source Error:


Line 18:
Line 19: SmtpClient mySmtpClient = new SmtpClient();
Line 20: mySmtpClient.Send(myMessage);
Line 21: }
Line 22: }

Source File: c:\BegASPNET\Site\Demos\Email.aspx.cs Line: 20

Stack Trace:


[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +6205944
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +134

[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +300
System.Net.DelegatedStream.Read(Byte[] buffer, Int32 offset, Int32 count) +45
System.Net.BufferedReadStream.Read(Byte[] buffer, Int32 offset, Int32 count) +105
System.Net.Mail.SmtpReplyReaderFactory.ReadLines(S mtpReplyReader caller, Boolean oneLine) +248
System.Net.Mail.SmtpReplyReaderFactory.ReadLine(Sm tpReplyReader caller) +16
System.Net.Mail.SmtpConnection.GetConnection(Servi cePoint servicePoint) +665
System.Net.Mail.SmtpTransport.GetConnection(Servic ePoint servicePoint) +222
System.Net.Mail.SmtpClient.GetConnection() +50
System.Net.Mail.SmtpClient.Send(MailMessage message) +1496

[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +1829
Demos_Email.Page_Load(Object sender, EventArgs e) in c:\BegASPNET\Site\Demos\Email.aspx.cs:20
System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225

If anyone else finds typos besides the ones that were kindly pointed out, perhaps they are the issue. I don't know. My frustration level is high, sorry for the sloppy posts. I will tighten things up next time.
 
Old August 31st, 2011, 06:42 PM
Authorized User
 
Join Date: Apr 2011
Posts: 11
Thanks: 4
Thanked 0 Times in 0 Posts
Default

My brain hates the combination SMTP!! I would like to append my last message "Even when I have smtp.outgoing.att.net** the code does not work. I just worked over my code AGAIN, no smtp errors. I am left with the error:
An existing connection was forcibly closed by the remote host
 
Old August 31st, 2011, 06:44 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,

The SMTP part of the server name used in the book is "just" an example, but one which is common for many mail servers. However, this is not a requirement and you'll find many mail servers that don't use this convention.

Your latest message seems to suggest that some server is listening to the address you're using, but doesn't allow you to connect to it, or doesn't allow you to use the port specified.

Do you have a Yahoo or Gmail account? If so, you can use that. You'll find an example for Gmail in the book.

Alternatively, if you just want to proceed with the book, you could also use a local drop folder as explained in Chapter 9.

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!
The Following User Says Thank You to Imar For This Useful Post:
BGrun08 (August 31st, 2011)
 
Old August 31st, 2011, 07:19 PM
Registered User
 
Join Date: Aug 2011
Posts: 13
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Quote:
Originally Posted by BGrun08 View Post
<system.net>
<mailSettings>
<smtp deliveryMethod="Network"
from="Brandon Grunwell &lt;[email protected]&gt;">
<network enableSsl="true" userName="[email protected]" password="correctpassword" port="465" host="smpt.outbound.att.net"/>
</smtp>
</mailSettings>
</system.net>
I don't know for sure, but these settings look correct except for the server name, which I think should be "smtp.att.yahoo.com".
The Following User Says Thank You to mmmason For This Useful Post:
BGrun08 (August 31st, 2011)
 
Old August 31st, 2011, 07:52 PM
Authorized User
 
Join Date: Apr 2011
Posts: 11
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thanks mmmason and Imar. Question for Imar: If I have a gmail account and and internet connection i can use that as an SMTP server? I am unfamiliar with networking completely, I for some reason was under the impression I had to use the e-mail from my ISP in order to have a server, or I had to set up something special with google for it to work. I had tried using my gmail e-mail, but not carefully, as i was unconvinced of its potential of success. But using the google outgoing port# 465 (according to a website I saw, same as at&t), my log in info , password, and smtp.google.com as the host, it should work? Is there not any issues with setting up a port number for the receiving e-mail address or anything like that?

Also, through another forum I was looking at, on a topic only somewhat similar, I saw something mentioned about the receiving e-mail server possibly recognizing SMTP as spam and not allowing the message through? Any truth to anything like that?

I know I can move on without completing this, but I just don't like leaving lose ends.

Thanks again





Similar Threads
Thread Thread Starter Forum Replies Last Post
Struggling with Ch 9 sending e-mail tjsully BOOK: Beginning ASP.NET 4 : in C# and VB 7 July 23rd, 2011 06:30 PM
Accessing e.Message of Sending mail event hirenmehta BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 8 November 30th, 2009 04:27 PM
Sending mail problem!!!! NitinJoshi General .NET 2 January 13th, 2005 08:31 AM
Problem with sending mail nikunjn VS.NET 2002/2003 1 January 29th, 2004 08:29 AM
Problem on sending message hossaini JSP Basics 1 June 23rd, 2003 01:44 AM





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