I've created a contact us form for my web site. I'd appreciate help or comments on the proper way to deal with the "[email protected]" part of this script. I think it should be blank "" because I don't know the visitors email address. <%@ Page Language="VB" MasterPageFile="~/Default.master" Title="Untitled Page" %> <%@ Import Namespace="System.Net.Mail" %> <script runat="server"> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim strFrom = "[email protected]" Dim strTo = "[email protected]" Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo)) MailMsg.BodyEncoding = Encoding.Default MailMsg.Subject = "Subject" MailMsg.Body = "This is a sample message" MailMsg.Priority = MailPriority.High MailMsg.IsBodyHtml = True 'Smtpclient to send the mail message Dim SmtpMail As New SmtpClient SmtpMail.Host = "localhost" End Sub </script> This is my entry in my web.config for sending the contact us form. <system.net> <mailSettings> <smtp> <network host="smtp.tricountyads.net" port="25" defaultCredentials="true" userName="" password=""/> </smtp> </mailSettings> </system.net>
"...I think it should be blank "" because I don't know the visitors email address" It depends of you. I send 2 email in the same time from my Contact Us: one email to my personal address (in google) which contains visitor IP address,DateTime, User Browser, e.t.c. I sendother email to the visitor with "Thank you message" and other details. Please remarc that visitor can fill out a non existent email address. Alexei Cioina. http://www.californiadreamhomesandland.com
Hi, Please look at the working code I posted in this thread: http://community.discountasp.net/default.aspx?f=24&m=25440 Salute, Mark