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):

<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>&nbsp;</td>
<td align="right"><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>

</form>

this is the code for the .asp page:

<% 
 
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.

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:

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!

please post your code error.

try to use this code:

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.