DaleP85
01-20-2005, 10:37 PM
Hello,
Basiclly i am having trouble with an asp script that sends the results of a form to an email address via CDOSYS with the email in HTML format, when the user clicks submit the action is set to the asp script, but i am not receiving anything and it appears to be doing nothing at all but sending me to an error 500 page.
also i am insure if i am getting the details of a form field correctly, for example in the html email i have it so it shows Date: <the field submission here>
if that makes sense, so it will show= Date: 20/01/04
i have only done this for the date and reference fields the rest will just show <>.
what i am using to do get the data from the form is: ShowFormField("Date")
also i am unable to get it to redirect to "thanks.html" once completed.
here is all of the code:
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4"
NAME="ADODB Type Library" -->
<!--This METADATA makes the CDO constants known to the system, like e. g. wie z.B. cdoSendUsingMethod-->
<html>
<body>
<%
Dim strFrom, strTo, strSubject, strBody
Dim objMessage, objConfig
strFrom = "forms@sophsoft.net" 'sender
strTo = "dale_pusey@bat.com" 'recipient
strSubject = "Consignment Note Submission" 'email subject
strBody = "<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<p> <IMG src="http://www.psap.co.uk/psp3.gif">
<address>
</address>
<address>
<font size="2"><span style="font-style: normal">Date: <b>ShowFormField("Date")</b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Ref:ShowFormField("Reference")<b><></b></span></font></address>
<address>
</address>
<address>
<font size="2">
<span style="font-style: normal; font-weight: 700; text-decoration: underline">
Shipper Information:</span></font></address>
<address>
<font size="2"><span style="font-style: normal">Shipper Name:
<b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">Shipper Address: <b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">
<b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Shipper City:
<b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">Shipper P.Code: <b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Shipper Country: <b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Shipper tel:
<b><></b></span></font></address>
<address>
</address>
<address>
<font size="2">
<span style="font-style: normal; font-weight: 700; text-decoration: underline">
Consignee Information:</span></font></address>
<address>
<font size="2"><span style="font-style: normal">Consignee Name:
<b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">Consignee Address: <b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">
<b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Consignee City:
<b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">Consignee P.Code: <b>
<></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Consignee Country: <b>
<></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Consignee tel:
<b><></b></span></font></address>
<address>
</address>
<address>
<font size="2">
<span style="font-style: normal; font-weight: 700; text-decoration: underline">
Consignment Details</span></font></address>
<address>
<font size="2"><span style="font-style: normal">Dangerous Goods? <b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Documents:
<b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Weight:
<b><></b></span></font></address>
<address>
</address>
<table border="1" cellspacing="0" cellpadding="0" width="553">
<tr>
<td width="167" align="center" bgcolor="#C0C0C0">
<address>
<span style="font-style: normal; font-weight: 700"><font size="2">
Description</font></span></address>
</td>
<td width="74" align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Items</span></font></address>
</td>
<td width="80" align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Weight</span></font></address>
</td>
<td width="77" align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Length</span></font></address>
</td>
<td width="72" align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Height</span></font></address>
</td>
<td align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Width</span></font></address>
</td>
</tr>
<tr>
<td width="167" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
<tr>
<td width="167">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td>
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
<tr>
<td width="167" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
<tr>
<td width="167">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td>
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
<tr>
<td width="167" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
</table>
<address>
</address>
<address>
<font size="2"><span style="font-style: normal">Value for Customs: <b><></b></span></font></address>
<address>
</address>
<address>
<font size="2">
<span style="font-style: normal; font-weight: 700; text-decoration: underline">
Special Delivery Instructions:</span></font></address>
<address>
<font size="2"><span style="font-style: normal"><></span></font></address>
</body>
</html>" 'email body (text)
'Creation of the Email Server Object
Set objMessage = CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.Configuration")
'Here is determined which way emails will be processed (local oder external
'server). Please always set an external server.
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
'Outgoing SMTP server with SMTP authentication
objConfig.Fields(cdoSMTPServer) = "auth.smtp.1and1.co.uk"
'SMTP port
objConfig.Fields(cdoSMTPServerPort) = 25
'Plain text authentication
objConfig.Fields(cdoSMTPAuthenticate) = cdoBasic
'account name
objConfig.Fields(cdoSendUserName) = "xxxx"
'password
objConfig.Fields(cdoSendPassword) = "xxxx"
objConfig.Fields.Update
Set objMessage.Configuration = objConfig
objMessage.To = strTo
objMessage.From = strFrom
objMessage.Subject = strSubject
objMessage.HTMLBody = strBody 'html mode
On Error Resume Next
objMessage.Send
If Err.Number = "0" Then
Response.Write("The message has been sent!")
Else
Response.Write("An error occured" & _
"during sending.")
response.write Err.Number & " " & Err.Description
Err.Number = "0"
End If
%>
does anyone know what i have done wrong?
The email that is sent is formatted in html.
the form can be viewed here (http://psap.co.uk/cn.htm)
no doubt the asp script looks terrible, i am new to asp and this is my first go so be gentle :)
Thanks
DP
Basiclly i am having trouble with an asp script that sends the results of a form to an email address via CDOSYS with the email in HTML format, when the user clicks submit the action is set to the asp script, but i am not receiving anything and it appears to be doing nothing at all but sending me to an error 500 page.
also i am insure if i am getting the details of a form field correctly, for example in the html email i have it so it shows Date: <the field submission here>
if that makes sense, so it will show= Date: 20/01/04
i have only done this for the date and reference fields the rest will just show <>.
what i am using to do get the data from the form is: ShowFormField("Date")
also i am unable to get it to redirect to "thanks.html" once completed.
here is all of the code:
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4"
NAME="ADODB Type Library" -->
<!--This METADATA makes the CDO constants known to the system, like e. g. wie z.B. cdoSendUsingMethod-->
<html>
<body>
<%
Dim strFrom, strTo, strSubject, strBody
Dim objMessage, objConfig
strFrom = "forms@sophsoft.net" 'sender
strTo = "dale_pusey@bat.com" 'recipient
strSubject = "Consignment Note Submission" 'email subject
strBody = "<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<p> <IMG src="http://www.psap.co.uk/psp3.gif">
<address>
</address>
<address>
<font size="2"><span style="font-style: normal">Date: <b>ShowFormField("Date")</b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Ref:ShowFormField("Reference")<b><></b></span></font></address>
<address>
</address>
<address>
<font size="2">
<span style="font-style: normal; font-weight: 700; text-decoration: underline">
Shipper Information:</span></font></address>
<address>
<font size="2"><span style="font-style: normal">Shipper Name:
<b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">Shipper Address: <b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">
<b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Shipper City:
<b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">Shipper P.Code: <b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Shipper Country: <b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Shipper tel:
<b><></b></span></font></address>
<address>
</address>
<address>
<font size="2">
<span style="font-style: normal; font-weight: 700; text-decoration: underline">
Consignee Information:</span></font></address>
<address>
<font size="2"><span style="font-style: normal">Consignee Name:
<b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">Consignee Address: <b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">
<b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Consignee City:
<b><></b>
</span></font>
</address>
<address>
<font size="2"><span style="font-style: normal">Consignee P.Code: <b>
<></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Consignee Country: <b>
<></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Consignee tel:
<b><></b></span></font></address>
<address>
</address>
<address>
<font size="2">
<span style="font-style: normal; font-weight: 700; text-decoration: underline">
Consignment Details</span></font></address>
<address>
<font size="2"><span style="font-style: normal">Dangerous Goods? <b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Documents:
<b><></b></span></font></address>
<address>
<font size="2"><span style="font-style: normal">Weight:
<b><></b></span></font></address>
<address>
</address>
<table border="1" cellspacing="0" cellpadding="0" width="553">
<tr>
<td width="167" align="center" bgcolor="#C0C0C0">
<address>
<span style="font-style: normal; font-weight: 700"><font size="2">
Description</font></span></address>
</td>
<td width="74" align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Items</span></font></address>
</td>
<td width="80" align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Weight</span></font></address>
</td>
<td width="77" align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Length</span></font></address>
</td>
<td width="72" align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Height</span></font></address>
</td>
<td align="center" bgcolor="#C0C0C0">
<address>
<font size="2"><span style="font-style: normal; font-weight: 700">
Width</span></font></address>
</td>
</tr>
<tr>
<td width="167" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72" bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td bgcolor="#EAF4FF">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
<tr>
<td width="167">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td>
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
<tr>
<td width="167" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
<tr>
<td width="167">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td>
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
<tr>
<td width="167" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="74" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="80" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="77" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td width="72" bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
<td bgcolor="#E5EEFD">
<address>
<font size="2" color="#FF0000"><span style="font-style: normal"><></span></font></address>
</td>
</tr>
</table>
<address>
</address>
<address>
<font size="2"><span style="font-style: normal">Value for Customs: <b><></b></span></font></address>
<address>
</address>
<address>
<font size="2">
<span style="font-style: normal; font-weight: 700; text-decoration: underline">
Special Delivery Instructions:</span></font></address>
<address>
<font size="2"><span style="font-style: normal"><></span></font></address>
</body>
</html>" 'email body (text)
'Creation of the Email Server Object
Set objMessage = CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.Configuration")
'Here is determined which way emails will be processed (local oder external
'server). Please always set an external server.
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
'Outgoing SMTP server with SMTP authentication
objConfig.Fields(cdoSMTPServer) = "auth.smtp.1and1.co.uk"
'SMTP port
objConfig.Fields(cdoSMTPServerPort) = 25
'Plain text authentication
objConfig.Fields(cdoSMTPAuthenticate) = cdoBasic
'account name
objConfig.Fields(cdoSendUserName) = "xxxx"
'password
objConfig.Fields(cdoSendPassword) = "xxxx"
objConfig.Fields.Update
Set objMessage.Configuration = objConfig
objMessage.To = strTo
objMessage.From = strFrom
objMessage.Subject = strSubject
objMessage.HTMLBody = strBody 'html mode
On Error Resume Next
objMessage.Send
If Err.Number = "0" Then
Response.Write("The message has been sent!")
Else
Response.Write("An error occured" & _
"during sending.")
response.write Err.Number & " " & Err.Description
Err.Number = "0"
End If
%>
does anyone know what i have done wrong?
The email that is sent is formatted in html.
the form can be viewed here (http://psap.co.uk/cn.htm)
no doubt the asp script looks terrible, i am new to asp and this is my first go so be gentle :)
Thanks
DP