Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 October 13th, 2009, 06:36 PM
Authorized User
 
Join Date: Sep 2009
Posts: 35
Thanks: 6
Thanked 1 Time in 1 Post
Default Question about email

Hey Imar,

For the life of me I could not get your code to work for sending out an email. I understood the code and it made perfect sense, but for some reason the way it was set up I kept getting errors on both my work PC and home PC which wouldn't allow me to send the email.

To get the code to work, I had to eliminate your instruction to insert code into the web config file and I just added these elements to the user control:

Dim mySmtpClient As New SmtpClient()
mySmtpClient.Host = "smtp.gmail.com"
mySmtpClient.Port = 587
mySmtpClient.Credentials = New System.Net.NetworkCredential("UserName@gmail.com", "YourPassword")
mySmtpClient.EnableSsl = True
mySmtpClient.Send(myMessage)

Now I am not sure if I was getting the errors because the code you specified didn't take into account that email requires SSL and a port (I tried adding the port to the webconfig) but it never worked until I deleted the section out of the webconfig and added that bit of extra code to the user control.

Do you think this is a reasonable alternative to your method? Is it any less secure since my email information will be sitting there?

Thanks again
Reply With Quote
  #2 (permalink)  
Old October 14th, 2009, 03:08 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,

In my book I am referring to this code as well when using a server that requires SSL. Search my book's forum category here at p2p.wrox.com for EnableSsl and you find a few more threads about the topic.

I can't test right now, but could you combine this and web.config? That is, get server and user data from web.config and set the rest through code.

Otherwise, considering wrapping the user name and password values in properties that access the web.config and move them to the <appSettings /> element in web.config. Check out Chapter 18 for more details.

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 14th, 2009, 03:39 PM
Authorized User
 
Join Date: Sep 2009
Posts: 35
Thanks: 6
Thanked 1 Time in 1 Post
Default

I will test it out at work today and see if I can move most of the sensitive date to the web.config and still get it to work. I'll get back to you.
Reply With Quote
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
Email question... iceman90289 ASP.NET 3.5 Basics 9 August 29th, 2009 09:44 AM
SMTP Email question snufse ASP.NET 2.0 Basics 2 July 9th, 2009 11:08 AM
Ch. 11 Email setup question amenne20 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 October 1st, 2006 04:04 PM
Ch. 11 Email setup question amenne20 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 1st, 2006 04:03 PM
Email Form - Question from a Newbie morgan270 ASP.NET 2.0 Basics 8 September 13th, 2006 03:58 PM



All times are GMT -4. The time now is 07:06 AM.


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