Wrox Programmer Forums
|
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 18th, 2011, 11:21 AM
Registered User
 
Join Date: Aug 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Talking Contacts form email no longer working

I successfully built the contacts form in chptr 9 such that it sent an email as entered in the form. Later I replaced my web.config file with the one provided by WROX. I correctly updated this file with my server and email info but the contacts form will no longer send email to addresses that are not on my server. But I can send an email to myself.

Neil
 
Old August 19th, 2011, 07:36 AM
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,

Did you configure an external mail server in the config file? If so, how do the setting look? Maybe that mail server is blocking your outgoing e-mail?

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!
 
Old August 21st, 2011, 06:18 PM
Registered User
 
Join Date: Aug 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Contact email form no longer working

Imar, really appreciate your responding to my question. Following is the code in the config file (password x'ed out):

Code:
 

<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="Nelson Miller &lt;[email protected]&gt;">
        <network host="mail.ndmiller.net" userName="[email protected]" password="XXXXX" port="50" />
      </smtp>
    </mailSettings>
  </system.net>
Here is the code I have in the send button in the contacts page:

Code:
Protected Sub SendButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendButton.Click
    If Page.IsValid Then
      Dim fileName As String = Server.MapPath("~/App_Data/ContactForm.txt")
      Dim mailBody As String = File.ReadAllText(fileName)

      mailBody = mailBody.Replace("##Name##", Name.Text)
      mailBody = mailBody.Replace("##Email##", EmailAddress.Text)
      mailBody = mailBody.Replace("##HomePhone##", PhoneHome.Text)
      mailBody = mailBody.Replace("##BusinessPhone##", PhoneBusiness.Text)
      mailBody = mailBody.Replace("##Comments##", Comments.Text)

      Dim myMessage As MailMessage = New MailMessage()
      myMessage.Subject = "Response from web site"
      myMessage.Body = mailBody

      myMessage.From = New MailAddress("[email protected]", "Nelson M.")
      myMessage.To.Add(New MailAddress("[email protected]", "N. Miller"))

      Dim mySmtpClient As SmtpClient = New SmtpClient()
      mySmtpClient.Send(myMessage)

      Message.Visible = True
      MessageSentPara.Visible = True
      FormTable.Visible = False
      System.Threading.Thread.Sleep(5000)
    End If
  End Sub

End Class
When I click the send button I get an error that the mailbox is unavailable and not on this server. If I change the "to" address to [email protected] it does work. I also have the same problem in chapter 15 when I am trying to send a email to a new user after they have just signed up.

thanks again,

Nelson
 
Old August 23rd, 2011, 12:25 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 Nelson,

This all looks good to me, except for the port number which is uncommon (but not necessarily incorrect). Have you talked to your mail server administrator? Maybe the server is blocking your e-mail?

As an alternative, you can use a Gmail / Yahoo / Hotmail account for outgoing messages. And if it's just about following along with the book you could also configure a local drop folder. This way, messages aren't really sent, but dropped as .eml files in a folder on disk.

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!
 
Old August 24th, 2011, 07:43 AM
Registered User
 
Join Date: Aug 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Contact email form no longer working

Thanks Imar, I have contacted the host and they can't see a problem from their side. Since this is just for completing the exercises in the book it doesn't need to be solved right now.

Thanks again

Nelson
 
Old August 24th, 2011, 01:26 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Right; in that case using a local drop folder as described on page 318 is probably the best way to proceed.

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Classic ASP email not working in Chrome? sdagger Classic ASP Basics 7 October 15th, 2010 02:42 PM
Email not working on remote server jtruffa BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 December 3rd, 2009 09:32 AM
Chap 17: Email not working tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 August 17th, 2009 08:57 AM
Chap 17: Email not working tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 0 August 15th, 2009 09:09 AM
Email counter not working !!! [email protected] ASP.NET 2.0 Professional 1 February 1st, 2009 12:48 PM





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