Author Topic: Help with ASP and SMTP  (Read 2224 times)

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Help with ASP and SMTP
« on: June 25, 2008, 07:34:27 PM »
So my one client uses ASP for his website, and recently i used google and a little brain power and got him a working contact form using his smtp. Client has now decided he wants to add a field for the would be customer's name and a field for their phone number. I have modified the form accordingly, but im not sure how to pass the two new variable so that they come out in the message body, above the comments. For example:

John Smith, 555-5555, and hi dude would show as (in email body)

John Smith
555-5555

Hi dude

Form

Code: [Select]
<!-- CONTACT FORM -->
<script language=javascript src="contactvalid.js"></script>
<FORM name="ContactForm" action="send_email.asp" method=post onSubmit="return validateContact()">

<table border=0>

<tr><td align=right>Name:&nbsp;</td>
    <td><input name="FromName" size=40 maxlength=50 class="inputbox"></td></tr>
<tr><td></td></tr>
<tr><td align=right>E-Mail:&nbsp;</td>
    <td><input name="FromEmail" size=40 maxlength=50 class="inputbox"></td></tr>
<tr><td></td></tr>
<tr><td align=right>Phone:&nbsp;</td>
    <td><input name="FromPhone" size=20 maxlength=20 class="inputbox"></td></tr>
<tr><td></td></tr>
<tr valign=top><td align=right>Comments:&nbsp;</td>
    <td><textarea name="Comments" class="inputbox" rows=5 cols=50></textarea></td></tr>
<tr><td><br></td></tr>
<tr><td align=right>&nbsp;</td>
    <td><input type=submit class="submitbutton"></td></tr>
<tr><td><br></td></tr>
<tr><td></FORM></td></tr>
</table>

<!----- END DATA ----->

send_email

Code: [Select]
<%
dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = request("FromEmail")
objMail.Subject = "Website Inquiry"
objmail.To = "management@naplescourtyardinn.com"
objMail.Body = request("Comments")
objMail.Send

Response.redirect ("http://www.naplescourtyardinn.com")
%>
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

JaWiB

  • definitelys definately no MacGyver
  • Jackass V
  • Posts: 1443
  • Karma: +57/-4
Re: Help with ASP and SMTP
« Reply #1 on: June 25, 2008, 07:50:10 PM »
Not sure I'm understanding correctly, but can you do something like:
Code: [Select]
objMail.Body = request("FromName")&vbCrLf&request("FromPhone")&vbCrLf&request("Comments")

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: Help with ASP and SMTP
« Reply #2 on: June 25, 2008, 07:52:57 PM »
Exactly what im looking for. I wasnt sure how to connect the three variables into one line. Sorry for bad explanation. Thanks man ill try it out.
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: Help with ASP and SMTP
« Reply #3 on: June 25, 2008, 08:02:56 PM »
Perfect, ty
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?