Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-09-2011, 12:41 AM   PM User | #1
yoitsike
New to the CF scene

 
Join Date: Mar 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
yoitsike is an unknown quantity at this point
ASP Form to Mail script

Hi,

I'm having a little difficulty with a E-mail form in ASP. It sends to my E-mail just fine but the responses when filling out the form do not appear in the e-mail, the e-mail is just blank. Can somebody help me out with the coding please?

This coding is on the actual asp form page..


Quote:
<FORM ACTION="formtomail.asp" METHOD="post">
<p align="center">
<span class="style12">Name : </span>
<input type="text" size="51" maxlength="256" name="Name" style="width: 264px"><p align="center">
<span class="style12">E-mail : </span>
<input type="text" size="48" maxlength="256" name="Email" style="width: 266px"><p align="center">
<INPUT TYPE=submit value="Submit">
</FORM>
This is the page the form sends all the information to..


Quote:
<%
Const cdoBasic = 1 'Use basic (clear-text) authentication.
Const cdoSendUsingPort = 2
'cdosys related
Dim iMsg
Dim iConf
Dim Flds
'mail related
Dim strMsg
Dim strTo
Dim strCC
Dim strFrom
Dim strSubject
Dim strTextBody


'==================begin your configuration=============================
'you must have a username and pass word or you will not be able to send
'
Dim sendusername : sendusername = "cyn@mycheaptravel.com"
Dim userpassword : userpassword = ""
Dim smtpserver : smtpserver = "mail54.opentransfer.com"
'end your configuration

'===================begin set your info here============================
'set your TO, CC, From, Subject and body here
'
strTo = "cyn@mycheaptravel.com"
strCC = ""
strFrom = "cyn@mycheaptravel.com"
strSubject = "My Cheap Travel Quotes"
strTextBody = ""
'end set your info here


'Create message and configuration objects
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
'Apply settings to the configuration object
With Flds
' Specify the authentication mechanism to basic (clear-text) authentication.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
' The username for authenticating to an SMTP server
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sendusername
' The password used to authenticate to an SMTP server
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = userpassword
' Port
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
'Specify mail server
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
'Specify the timeout in seconds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
' The port on which the SMTP service specified by the smtpserver field is listening for connections (typically 25)
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Update
End With

'Apply the settings to the message object and send it
With iMsg
Set.Configuration = iConf
.To = strTo
.From = strFrom
If strCC <> "" Then
.CC = strCC
End If
.Subject = strSubject
.TextBody = strTextBody
'Send message
.Send
End With
' cleanup mail objects
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>
Can somebody please let me know why it is not sending the information that is posted on the form to my e-mail is something not coded properly? Thanks in advance!
yoitsike is offline   Reply With Quote
Old 04-06-2011, 07:08 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
you are not defining where the body of your message is coming from.

try changing

Code:
strTextBody = ""
to
Code:
strTextBody = request("email")
also in your form you ask for a name to be entered. did you want this included in the email somewhere?

Last edited by DanInMa; 04-06-2011 at 07:10 PM..
DanInMa is offline   Reply With Quote
Old 04-06-2011, 08:01 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
As Dan said, *YOU* have to create the body of the mail as you want it.

You could, for example, do something like this:
Code:
strTextBody = "Name: " & Request("Name") & vbNewLine & "Email: " & Request("Email") & vbNewLine
'end set your info here
The body *is* part of "your info".
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:09 AM.


Advertisement
Log in to turn off these ads.