Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-08-22
6
Medium Priority
?
664 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
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:Antonio Vargas
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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 15

Assisted Solution

by:Antonio Vargas
Antonio Vargas 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

916 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