?
Solved

web.config email settings.  Not receiving email from contact form,

Posted on 2010-08-22
6
Medium Priority
?
657 Views
Last Modified: 2013-11-27
Trying to make my first contact email form.  I am using the following web.config mailsettings but am not receiving the emails.  The test/book site is live if that makes a difference. aex1.com     I used code from wrox book with a contact form and submit button. Should I be using "postmaster@discountasp.net" or my email "johndoe@aex1.com  ?  In outlook I am using smtp port 587 if that makes a difference.  Should the username and password be blank or filled in? When trying at an earlier date I did receive some delivery failure emails that said "could not deliver to johndoe@aex1.com.com  (2 .com's in email?)  Thanks

 <system.net>
    <mailSettings>
      <smtp from="postmaster@discountasp.net">
        <network host="localhost" port="25"
userName=""
password=""
defaultCredentials="true" />
      </smtp>
    </mailSettings>
  </system.net>
0
Comment
Question by:ExpressMan1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:GreatVargas
ID: 33497735
network host="localhost" port="25
is your email server on the same server where you have the site? because he is trying to authenticate on locahost to send mail.. he should be trying to authenticate on your email server,
0
 

Author Comment

by:ExpressMan1
ID: 33497813
Yes my email is with the same ISP.  I just tried the following mailsettings, no luck.

<system.net>
    <mailSettings>
      <smtp from="postmaster@discountasp.net">
        <network host="discountasp.net" port="25"
userName=""
password=""
defaultCredentials="true" />
      </smtp>
    </mailSettings>
  </system.net>
0
 
LVL 14

Accepted Solution

by:
Dhanasekaran Sengodan earned 1000 total points
ID: 33500398
0
Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

 
LVL 15

Assisted Solution

by:GreatVargas
GreatVargas earned 1000 total points
ID: 33500731
can you telnet discountasp.net on port 25 from your web server?

do from the prompt:

telnet discountasp.net 25

post the result
0
 

Author Comment

by:ExpressMan1
ID: 33501385
I tried all the variations of setting up the web.config as suggested in the links above. No luck. I am not testing locally, the site is live at aex1.com, under the about tab there is a contact form.
Here is the code from the contact form,

Imports System.Net.Mail

Partial Class Controls_ContactForm
  Inherits System.Web.UI.UserControl

  Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
    If txtPhoneHome.Text IsNot String.Empty Or txtPhoneBusiness.Text IsNot String.Empty Then
      args.IsValid = True
    Else
      args.IsValid = False
    End If
  End Sub

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

      mailBody = mailBody.Replace("##Name##", txtName.Text)
      mailBody = mailBody.Replace("##Email##", txtEmailAddress.Text)
      mailBody = mailBody.Replace("##HomePhone##", txtPhoneHome.Text)
      mailBody = mailBody.Replace("##BusinessPhone##", txtPhoneBusiness.Text)
      mailBody = mailBody.Replace("##Comments##", txtComments.Text)

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

      myMessage.From = New MailAddress("you@yourprovider.com", "Sender Name Here")
      myMessage.To.Add(New MailAddress("you@yourprovider.com", "Receiver Name Here"))

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

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

   
0
 

Author Closing Comment

by:ExpressMan1
ID: 33501516
OK, It's working.  Embarrassing, I didn't enter my email in the behind code of the contact form.!  Thanks for your help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question