Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

aspmail problem part2

Status
Not open for further replies.

Jeremy74

IS-IT--Management
Nov 21, 2001
56
GB
I decided to repost this to try and make it clearer as it's driving me nuts.

I am trying to get a form to submit the users email to the FromAddress function.

The form I am using did not have any editable text fields in, it is a details page for users to check details. I could not get these fields to submit to the email so I created hidden text fields with Sessions in.

<input name=&quot;firstname&quot; type=&quot;hidden&quot; id=&quot;firstname&quot; value=&quot;<%=(session1.Fields.Item(&quot;firstname&quot;).Value)%>&quot;>
<input name=&quot;email&quot; type=&quot;hidden&quot; id=&quot;email&quot; value=&quot;<%=(session1.Fields.Item(&quot;email&quot;).Value)%>&quot;>

This works but I still can’t get the email field to work with this piece of code. The email and firstname are submitted to the body of the text okay.

<%
fromName=&quot;Bphf.com&quot;
fromAddress=&quot;info@bphf.com&quot;
toName=&quot;jeremy&quot;
toAddress=Request.Form(&quot;email&quot;)<<<<<<<<<<<<<<
subject=&quot;BPHF Membership&quot;
relay=&quot;192.168.1.7&quot;
%>

I have tried to put RESPONSE (“email”) as suggested in my previous post. I have also tried taking out – in the names.

The Code

Details.asp

<%
fromName=&quot;Bphf.com&quot;
fromAddress=&quot;info@bphf.com&quot;
toName=&quot;jeremy&quot;
toAddress=Request.Form(&quot;email&quot;)<<<<<<<<<<<<<<
subject=&quot;BPHF Membership&quot;
relay=&quot;192.168.1.7&quot;
%>


-
-
-
<form action=&quot;form_response.asp&quot; method=&quot;post&quot; name=&quot;form1&quot; onSubmit=&quot;YY_checkform('form1','firstname','#q','0','Field \'firstname\' is not valid.','sirname','#q','0','Field \'sirname\' is not valid.','email','S','2','Field \'email\' is not valid.','Password','#q','0','Field \'Password\' is not valid.','Password2','#Password','6','Field \'Password2\' is not valid.');return document.MM_returnValue&quot;>
<input type=&quot;hidden&quot; name=&quot;feedback&quot; value=&quot;:: Welcome to Busy People Having Fun ::&quot;>
<input type=&quot;hidden&quot; name=&quot;mail-subject&quot; value=&quot;<%=subject%>&quot;>
<input type=&quot;hidden&quot; name=&quot;mail-relay&quot; value=&quot;<%=relay%>&quot;>
<input type=&quot;hidden&quot; name=&quot;mail-toaddress&quot; value=&quot;<%=toAddress%>&quot;>
<input type=&quot;hidden&quot; name=&quot;mail-to&quot; value=&quot;<%=toName%>&quot;>
<input type=&quot;hidden&quot; name=&quot;mail-fromAddress&quot; value=&quot;<%=fromAddress%>&quot;>
<input type=&quot;hidden&quot; name=&quot;mail-from&quot; value=&quot;<%=fromName%>&quot;>
<input name=&quot;firstname&quot; type=&quot;hidden&quot; id=&quot;firstname&quot; value=&quot;<%=(session1.Fields.Item(&quot;firstname&quot;).Value)%>&quot;>
<input name=&quot;email&quot; type=&quot;hidden&quot; id=&quot;email&quot; value=&quot;<%=(session1.Fields.Item(&quot;email&quot;).Value)%>&quot;>
<table align=&quot;center&quot;>
<!--DWLayoutTable-->
<tr valign=&quot;baseline&quot;>
<td width=&quot;122&quot; height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>*Title:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;title&quot;).Value)%> </td>
<td width=&quot;15&quot;></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>*Firstname:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;firstname&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>*Surname:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;sirname&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>*Email:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;email&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>&nbsp;&nbsp;Company:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;company&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>&nbsp;&nbsp;Position:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;position&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>&nbsp;&nbsp;Address:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;address1&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>&nbsp;&nbsp;Town:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;address2&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>&nbsp;&nbsp;Region:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;address3&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>&nbsp;&nbsp;Postcode:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;postcode&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>*Password:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;Password&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>*Repeat Password:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;Password&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>&nbsp;&nbsp;Telephone:</td>
<td class=&quot;detailtxt&quot;><%=(session1.Fields.Item(&quot;telephone&quot;).Value)%> </td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;16&quot; align=&quot;right&quot; nowrap class=&quot;BPHF&quot;>&nbsp;&nbsp;Newsletter:</td>
<td class=&quot;detailtxt&quot;> <p class=&quot;maintxt&quot;><%=(session1.Fields.Item(&quot;Newsletter&quot;).Value)%></p></td>
<td></td>
</tr>
<tr valign=&quot;baseline&quot;>
<td height=&quot;20&quot; valign=&quot;top&quot; class=&quot;BPHF&quot;><a href=&quot;form_response.asp&quot;>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;>
<br>
Accept</a></td>
<td> <p class=&quot;BPHF&quot;><a href=&quot;edit.asp&quot;><br>
Edit</a></p></td>
<td></td>
</tr>
</table>
</form>


Respone_form

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<%
my_from=request(&quot;mail-fromName&quot;)
my_fromAddress=request(&quot;mail-fromaddress&quot;)
my_to=request(&quot;mail-toName&quot;)
my_toAddress=request(&quot;mail-toaddress&quot;)
my_subject=request(&quot;mail-subject&quot;)
my_relay=request(&quot;mail-relay&quot;)

Set Mailer = Server.CreateObject(&quot;SMTPsvg.Mailer&quot;)
Mailer.RemoteHost = my_relay

Mailer.FromName = my_from
Mailer.FromAddress = my_fromAddress
Mailer.AddRecipient my_to, my_toaddress
Mailer.Subject = my_subject

sBodyText = &quot;Welcome to Busy People Having Fun&quot; & vbcrlf & vbcrlf
sBodyText = sBodyText & &quot;Hello &quot; & request.form(&quot;firstname&quot;) & vbCrLf
sBodyText = sBodyText & &quot;Last Name: &quot; & request.form(&quot;sirname&quot;) & vbCrLf
sBodyText = sBodyText & &quot;Company: &quot; & request.form(&quot;company&quot;) & vbCrLf
sBodyText = sBodyText & &quot;Email Address: &quot; & request.form(&quot;email&quot;) & vbCrLf & Chr(13) & Chr(10) & Chr(13) & Chr(10)
sBodyText = sBodyText & &quot;&quot; & request.form(&quot;password&quot;) & vbCrLf
sBodyText = sBodyText & &quot;&quot; & request.form(&quot;telephone&quot;) & vbCrLf
Mailer.BodyText = sBodyText

If Mailer.SendMail then
Msg = &quot;Thank you for your enquiry.<br> A member of staff will contact you shortly.&quot;
Else
Msg = &quot;mail was not sent successfully<br>&quot;
msg = msg & mailer.response & &quot;<br>&quot;
End If

response.write Msg
%>
</body>
</html>

Thanks for the previous suggestions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top