| | |
ASP Email Form Sending but Content Not Being Sent
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2009
Posts: 1
Reputation:
Solved Threads: 0
Hi. I'm pretty new to the ASP part of the web developement world and need some help.
I built an ASP form that sends and works pretty musch exactly liek I want it to. The problem is that when the results of the form are emailed, you recieve a blank email. I should be receiving an email with the senders name, email, and comments. My hosting company thinks that there is something missing from that code that would make that information send or that the page that the code is .htm when it should be .asp. Could someone help me figure out whats wrong with my code so the information thats trying to be sent is actually getting sent?
Here is the code for my form (I have this in both .htm and .asp):
this is the code for the .asp page:
Thank you so much.
I built an ASP form that sends and works pretty musch exactly liek I want it to. The problem is that when the results of the form are emailed, you recieve a blank email. I should be receiving an email with the senders name, email, and comments. My hosting company thinks that there is something missing from that code that would make that information send or that the page that the code is .htm when it should be .asp. Could someone help me figure out whats wrong with my code so the information thats trying to be sent is actually getting sent?
Here is the code for my form (I have this in both .htm and .asp):
ASP Syntax (Toggle Plain Text)
<form name="Testing" method="post" action="ASPEmail_confirm.asp"> <table cellpadding="2" cellspacing="2"> <tr> <td height="40" colspan="2" bgcolor="white">ASPEmail - Contact Form</td> </tr> <tr> <td>Your Name:</td> <td><input name="VisitorName" type="text" size="46" /></td> </tr> <tr> <td>Your Email:</td> <td><input name="VistorEmail" type="text" size="46" /></td> </tr> <tr> <td valign="top">Your Message:</td> <td><textarea name="VistorComments" cols="35" rows="10"></textarea></td> </tr> <tr> <td> </td> <td align="right"><input type="submit" name="Submit" value="Submit" /></td> </tr> </table> </form>
this is the code for the .asp page:
ASP Syntax (Toggle Plain Text)
<% DIM strVName, strVEMail, strVComments strVName = request.form("VisitorName") strVEMail = request.form("VisitorEMail") strVComments = request.form("VisitorComments") %> <% DIM Mail, strMsgHeader Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = "mail.example.com" Mail.Username = "example@example.com" Mail.Password = "xxxxx" Mail.From = strVEMail Mail.FromName = strVName Mail.AddAddress "example@example.net" Mail.AddReplyTo strVEMail Mail.Subject = "Email From Your Website" Mail.Body = strVComments %> <% On Error Resume Next Mail.Send Set Mail = Nothing IF Err <> 0 THEN Response.Write "There has been an error and your message could not be sent at this time using this form. Please contact us directly at (xxx)xxx-xxxx. " & Err.Description END IF %>
Thank you so much.
Last edited by Ezzaral; Jun 19th, 2009 at 6:02 pm. Reason: Snipped personal info from code.
•
•
Join Date: Jun 2009
Posts: 2
Reputation:
Solved Threads: 0
Not sure what is wrong with your code but thought I could suggest a code to you which I use. Grabs all the information fine everytime:
I know it's not a solution but it's been useful for me!
ASP Syntax (Toggle Plain Text)
If Request.Form.Count > 0 Then Const cdoSendUsingMethod = _ "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSendUsingPort = 1 Const cdoSMTPServer = _ "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort = _ "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const cdoSMTPConnectionTimeout = _ "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" Const cdoSMTPAuthenticate = _ "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" Const cdoBasic = 1 Const cdoSendUserName = _ "http://schemas.microsoft.com/cdo/configuration/sendusername" Const cdoSendPassword = _ "http://schemas.microsoft.com/cdo/configuration/sendpassword" Dim objConfig ' As CDO.Configuration Dim objMessage ' As CDO.Message Dim Fields ' As ADODB.Fields Dim title, firstname, surname, email, confirmemail, reason, other, enquiry title = Request.Form("title") firstname = Request.Form("firstname") surname = Request.Form("surname") email = Request.Form("email") confirmemail = Request.Form("confirmemail") reason = Request.Form("reason") other = Request.Form("other") enquiry = Request.Form("enquiry") ' Get a handle on the config object and it's fields Set objConfig = Server.CreateObject("CDO.Configuration") Set Fields = objConfig.Fields ' Set config fields we care about With Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "smtp.yoursite.co.uk" .Item(cdoSMTPServerPort) = 25 .Item(cdoSMTPConnectionTimeout) = 10 .Item(cdoSMTPAuthenticate) = cdoBasic .Item(cdoSendUserName) = "you@yoursite.co.uk" .Item(cdoSendPassword) = "password" .Update End With Set objMessage = Server.CreateObject("CDO.Message") Set objMessage.Configuration = objConfig With objMessage .To = "whatever@where.com" .From = "whoever@where.co.uk" .Subject = "Customer Enquiry" .TextBody = "SMTP Relay Test Sent @ " & Now() & vbCrLf & "title: " & title & vbCrLf & "firstname: " & firstname & vbCrLf & "surname: " & surname & vbCrLf & "email: " & email & vbCrLf & "confirmemail: " & confirmemail & vbCrLf & "reason: " & reason & vbCrLf & "other: " & other & vbCrLf & "enquiry: " & enquiry .Send End With Set Fields = Nothing Set objMessage = Nothing Set objConfig = Nothing End If %>
I know it's not a solution but it's been useful for me!
•
•
Join Date: Jun 2008
Posts: 36
Reputation:
Solved Threads: 1
please post your code error.
try to use this code:
try to use this code:
ASP Syntax (Toggle Plain Text)
sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing" smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver" ' Set the mail server configuration Set objConfig=CreateObject("CDO.Configuration") objConfig.Fields.Item(sendUrl)=2 ' cdoSendUsingPort objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net" objConfig.Fields.Update ' Create and send the mail Set objMail=CreateObject("CDO.Message") ' Use the config object created above Set objMail.Configuration=objConfig objMail.Subject="Subject" objMail.From="YourEmail@email.com" objMail.To="Email" objMail.HTMLBody= "Text" objMail.Send
Last edited by peter_budo; Jul 17th, 2009 at 2:13 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- Form not sending info... (PHP)
- Simple Email Form in ASP.Net (ASP.NET)
- ASP Email "Reply To" Issue (ASP)
- Is it possible to create an "Email a Friend" or and email form... (ASP)
- Please help with email form script (PHP)
- Form not sending email (PHP)
- Need help with this email form (Java)
- Error message when running ASP email script (ASP)
Other Threads in the ASP Forum
- Previous Thread: save dynamically created table in sql using asp
- Next Thread: redirect user to another page if error 404
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7





