I'm trying to create simple form to send Thank you email to customer after filling the form.
I'm testing it on simple form (see below), when I use actual email addresses (my email) in TO: and FROM:; I will receive "Simple CDO message" email, but if I use the code below (geting the email address (FROM from form - emailAddress field) after submit the page is redirected to thankyou.asp but no email is send to me.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim strEmail
strEmail = Trim(Request.Form("emailAddress"))
If (strEmail <> "" ) Then
theSchema = "
Set cdoConfig = server.CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(theSchema & "sendusing") = 2 ' cdoSendUsingPort
.Item(theSchema & "smtpserver") = "tfpmail1.domain.com"
.Item(theSchema & "smtpserverport") = 25
.Item(theSchema & "smtpconnectiontimeout") = 60
.update
End With
Set cdoMessage = server.CreateObject("CDO.Message")
with cdoMessage
Set.Configuration = cdoConfig
.From = strEmail
.To = "myemail@domain.com"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With
End If
Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>email</title>
</head>
<body>
<form method="post" id=form1 name=form1 action="thankyou.asp" >
<b>Enter your email address:</b><br>
<input name="emailAddress" type="text" id="emailAddress" value="<%=Request.Form("emailAddress")%>" />
<p>
<input type="submit" name="Submit" value="Submit" id="Submit"/>
</form>
</body>
</html>
What am I missing?? any help would be appreciated.
Michal
I'm testing it on simple form (see below), when I use actual email addresses (my email) in TO: and FROM:; I will receive "Simple CDO message" email, but if I use the code below (geting the email address (FROM from form - emailAddress field) after submit the page is redirected to thankyou.asp but no email is send to me.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim strEmail
strEmail = Trim(Request.Form("emailAddress"))
If (strEmail <> "" ) Then
theSchema = "
Set cdoConfig = server.CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(theSchema & "sendusing") = 2 ' cdoSendUsingPort
.Item(theSchema & "smtpserver") = "tfpmail1.domain.com"
.Item(theSchema & "smtpserverport") = 25
.Item(theSchema & "smtpconnectiontimeout") = 60
.update
End With
Set cdoMessage = server.CreateObject("CDO.Message")
with cdoMessage
Set.Configuration = cdoConfig
.From = strEmail
.To = "myemail@domain.com"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With
End If
Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>email</title>
</head>
<body>
<form method="post" id=form1 name=form1 action="thankyou.asp" >
<b>Enter your email address:</b><br>
<input name="emailAddress" type="text" id="emailAddress" value="<%=Request.Form("emailAddress")%>" />
<p>
<input type="submit" name="Submit" value="Submit" id="Submit"/>
</form>
</body>
</html>
What am I missing?? any help would be appreciated.
Michal