Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : 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 Display Modes
  #1 (permalink)  
Old October 18th, 2013, 01:40 AM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Web.Config SMTP Settings

I am little bit confused here considering the following:

Code:
<mailSettings>
      <smtp>
      <network host="localhost" port="587" userName="XXX@ruidosocorn.biz" password="XXXX" />
    </smtp>

    </mailSettings>
How do I add the To and From part of the mail setting in the smtp node. I was looking at the book I just couldn't quite put it together. I am not sure how that would look like. I don't see a clear example on this in the book.

Thank you :-)
Could I do this maybe?:
Code:
<smtp>
      <network host="localhost" port="587" from="XXX@ruidosocorn.biz" to="Imar@ImarProductions.com" userName="XXX@ruidosocorn.biz" password="XXXX" />
    </smtp>
Would that work maybe?
Seeing as how this code is sitting on a remote production server, there is no way I can test this out locally. So before I make changes I want to make sure that I have the right code or I just might crash the application and cause all kinds of headaches galore that I don't want to endure with right now. I guess in a way this becomes a deployment issue and I need to ask someone has a lot more experience of deploying .NET apps than I do, and seeing as how SMTP and deployment are big parts of the book, think that is is a fair question.

Thanks :-)

Last edited by vbboyd; October 18th, 2013 at 01:54 AM.
Reply With Quote
  #2 (permalink)  
Old October 18th, 2013, 06:50 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,955
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

You can find an example of the from attribute on page 335 in Chapter 9.

The To can't be set in web.config as it relates to individual messages, not to the global settings.

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
  #3 (permalink)  
Old October 18th, 2013, 11:07 AM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default

Quote:
Originally Posted by Imar View Post
You can find an example of the from attribute on page 335 in Chapter 9.

The To can't be set in web.config as it relates to individual messages, not to the global settings.

Cheers,

Imar
That is where I am getting confused. Given the following web.config entry
Code:
<mailSettings>
      <smtp>
      <network host="localhost" port="587" userName="XXX@ruidosocorn.biz" password="XXXX" />
    </smtp>

    </mailSettings>
would the <smtp> node look like this?:

<network host="localhost" port="587" from="XXX &lt;XXX@ruidosocorn.biz" userName="XXX@ruidosocorn.biz" password="XXXX" />

Or would it look like this:
<network host="localhost" port="587" from="XXX@ruidosocorn.biz" userName="XXX@ruidosocorn.biz" password="XXXX" />
As I look at page 335 in the book I see:
from="Your Name &lt;you@example.com
I am confused about the &lt part of your SMTP string.

I am confused about the syntax on this SMTP node of which is the correct to use and seeing as how the app is posted to a very remote production server, I have no way of testing it without crashing the application. Which begs another question is there anywhere in the book that talks about remote testing of an application resting on very far away production server that can accessed via the Visual Studio IDE? Is that even possible.
Reply With Quote
  #4 (permalink)  
Old October 18th, 2013, 03:35 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,955
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

If you just want to display the e-mail address, simply use:

from="someaddress@example.com"

If you also want to use a display name, the format is:

Display Name <emailaddress>

Since < and > have special meaning, you need to encode them as &gt; and &lt; which results in the following code:

from="Your Name &lt;you@example.com &gt;">

where Your Name is the display name, and you@example.com the e-mail address.

You can try this stuff out locally as well if you're unsure about the syntax.

>> is there anywhere in the book that talks about remote testing of an application resting on very far away production server

I think you've read the whole book about now, so I think you know the answer to that question. Hint: it's No ;-)

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 October 18th, 2013, 04:31 PM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default

I think you've read the whole book about now, so I think you know the answer to that question. Hint: it's No ;-)

Imar[/quote]

Truth be it known, I really haven't read through too much of the appendix sections of the book at all. I thought that it might be there. My bad. Casi Nada Señor, which is Texas for "hardly any guy". That is why I was asking. Thanks for letting me know, that way I wouldn't waste any time looking around for material in the back of the book that does not exist.
Reply With Quote
  #6 (permalink)  
Old October 18th, 2013, 09:47 PM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Continued Error message

I made the changes that are in the book and that you recommended and I still get the following error code message

Code:

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Unrecognized attribute 'from'. Note that attribute names are case-sensitive.

Source Error: 


Line 53:     <mailSettings>
Line 54:       <smtp>
Line 55:       <network host="localhost" port="587" from="MX@ruidosovalley.com" userName="MX@ruidosovalley.com" password="ABC123" />
Line 56:     </smtp>
Line 57:
So I don't know what is wrong here. Maybe you can tell me.
Reply With Quote
  #7 (permalink)  
Old October 20th, 2013, 07:18 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,955
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Take another look at the error message:

Quote:
Unrecognized attribute 'from'.
And then compare your code with the example on page 335. You added the from attribute to the wrong element.

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
  #8 (permalink)  
Old October 20th, 2013, 10:41 AM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default

Quote:
Originally Posted by Imar View Post
Take another look at the error message:


And then compare your code with the example on page 335. You added the from attribute to the wrong element.

Cheers,

Imar
Thanks but I have already taken care of it just this morning and so far it seems to be working just fine.

Prost

:-)
Reply With Quote
  #9 (permalink)  
Old September 29th, 2014, 05:13 PM
Authorized User
Points: 62, Level: 1
Points: 62, Level: 1 Points: 62, Level: 1 Points: 62, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2014
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Default what did you do?

I've had the same problem and I cannot figure out what I am missing. I've gone over the example in book and still nada. Do I need to edit the code anywhere else besides the web.config and contact control?

You can send the email through Gmail while your debugging, correct? Or does the site have to be active to use gmail?

I've edited the web.config file and the contact control.

I'm at work rght now so unfortunately I can't include code that I'm using.

What did you ultimately have to do to use Gmail?
Reply With Quote
  #10 (permalink)  
Old September 29th, 2014, 05:27 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,955
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Hi there,

Take a look at page 335 for an example on using Gmail.

Do you have the code in your config file?

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
Reply


Thread Tools
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
Blog - Web.Config Settings for Access Database kanzeon4 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 April 5th, 2008 08:46 AM
Web.Config and Settings dsr771 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 August 13th, 2007 01:59 PM
Config of default smtp web server on IIS 5.0 kumarop Classic ASP Components 0 February 20th, 2005 04:22 AM
Web.Config Settings debsoft VS.NET 2002/2003 1 December 11th, 2003 06:06 PM



All times are GMT -4. The time now is 12:32 AM.


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