Format Info From a Form in a ASP File To Be Sent In An e-Mail 
Author Message
 Format Info From a Form in a ASP File To Be Sent In An e-Mail

Hi:

I have the following file that (when actual e-mail addresses are used) sends
the info input into the form in an e-mail to the appropriate address. The
information in the e-mail is just straight text.

What I would like to do is to have the information sent in the e-mail in the
same Form Format that the individual sees on the Inertnet when the info is
input into the Form ( the form boxes and spacing etc.), rather than just the
text, which is a little harder to follow than info in a form.

An alternative, would be to format the information sent in the e-mail so
that I can bold/change font size/underline etc certain headings that are
sent in the e-mail.

Can anyone provide any suggestions for either of the above approaches?

Thanks in advance.

Evan

============================================================================
========

<%
 requestType = Request.Form("requestType")

 if(requestType = "sendmail") then
  fName = Request.Form("fName")
  fDistance = Request.Form("fDistance")
  fLocation = Request.Form("fLocation")
  fYourName = Request.Form("fYourName")
  fYourEmail = Request.Form("fYourEmail")
  fEmail = Request.Form("fEmail")
  error = 0
  message = "<center><p><font color=#dbdb70><b>Error! Please fill in:<font
color=#ff0000><br>"

  if(fPatientName = "") then
   error = 1
   message = message & "Patient's name<br>"
  end if
  if(fDrug = "") then
   error = 1
   message = message & "Drug Information<br>"
  end if
  if(fLocation = "") then
   error = 1
   message = message & "Patient's Location<Br>"
  end if
  if(fYourName = "") then
   error = 1
   message = message & "Your Name<Br>"
  end if
  if(fYourEmail = "") then
   error = 1
   message = message & "Your e-mail<br>"
  end if
  if(fEmail = "") then
   error = 1
   message = message & "My e-mail<br>"
  end if

  message = message & "</b></font></font></p><br></center>"

  if(error <> 1) then
   body = "Name:" & fName & "" & vbCrLf & vbCrLf
   body = body & "Location:" & fLocation & "" & vbCrLf & vbCrLf
   body = body & "Distance:" & fDistance & "" & vbCrLf & vbCrLf
   body = body & "Your Name:" & fYourName & "" & vbCrLf & vbCrLf
   Set objMail = CreateObject("CDONTS.NewMail")
   objMail.To = fEmail
   objMail.From = fYourEmail
   objMail.Subject = "Distance Traveled Information"
   objMail.Body = body
   objMail.Send
   Set objMail = Nothing

   message = "<p><center><font color=#dbdb70><H3><b>Message has been sent
succesfully!</b></H3></font></center></p><br>"
  end if

 end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<META content="MSHTML 5.00.3207.2500" name=GENERATOR></HEAD>
<BODY bgColor=floralwhite><FONT color=black>

<FORM action=test2.asp method=post name=DistanceForm>
<TABLE border=0 cellPadding=2 cellSpacing=2>
  <TBODY>
  <TR>
    <TD colSpan=3><%=message%></TD>
  <TR>
    <TD align=left vAlign=center><FONT color=black
      face=arial,geneva,helvetica,sans-serif size=3><B>Name</B></FONT> </TD>
    <TD align=left vAlign=center><B><INPUT maxLength=50 name=fName
      size=32></B> </TD></TR>
  <TR>
    <TD align=left vAlign=center><FONT color=black
      face=arial,geneva,helvetica,sans-serif size=3><B>Location</B></FONT>
</TD>
    <TD align=left vAlign=center><B><INPUT maxLength=50 name=fLocation
      size=32></B> </TD></TR>
  <TR>
    <TD align=left vAlign=center><FONT color=black
      face=arial,geneva,helvetica,sans-serif size=3><B>Distance
Information</B></FONT> </TD>
    <TD align=left vAlign=center><B><INPUT maxLength=50 name=fDistance
      size=32></B> </TD></TR>
  <TR>
    <TD align=left vAlign=center><FONT color=black
      face=arial,geneva,helvetica,sans-serif size=3><B>Your Name</B></FONT>
</TD>
    <TD>
    <SELECT NAME="fYourName" SIZE=1>
     <OPTION VALUE="">
     Click to Select Your Location
    <OPTION VALUE="Nurse 1">Name 1
    <OPTION VALUE="Nurse 2">Name 2
    <OPTION VALUE="Nurse 3">Name 3
    </SELECT>
    </TD></TR>
 <TR>
    <TD align=left vAlign=center><FONT color=black
      face=arial,geneva,helvetica,sans-serif size=3><B>Your e-Mail
Address</B></FONT> </TD>
    <TD>
    <SELECT NAME="fYourEmail" SIZE=1>
     <OPTION VALUE="">
     Click to Select Your e-Mail Address




    </SELECT>
 </TD></TR>
  <TR>
    <TD align=left vAlign=center><FONT color=black
      face=arial,geneva,helvetica,sans-serif size=3><B>Send Request To
 </B></FONT> </TD>
    <TD>
    <SELECT NAME="fEmail" SIZE=1>
     <OPTION VALUE="">
     Click to Select Location To Send To




    </SELECT>
 </TD>
  </TR>
  <TR>
    <TD colSpan=3>&nbsp;<BR><INPUT name=Submit type=submit value="Send"
ALIGN="MIDDLE">
    </TD></TR></FONT></TBODY></TABLE>
    <input type=hidden name=requestType value="sendmail">

    </FORM></FONT></BODY></HTML>



Sat, 30 Aug 2003 12:02:12 GMT  
 Format Info From a Form in a ASP File To Be Sent In An e-Mail

BodyFormat Property (CDONTS NewMail Object)
http://msdn.microsoft.com/library/psdk/cdo/_denali_bodyformat_propert...
s_newmail_object_.htm

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> Hi:

> I have the following file that (when actual e-mail addresses are used)
sends
> the info input into the form in an e-mail to the appropriate address. The
> information in the e-mail is just straight text.

> What I would like to do is to have the information sent in the e-mail in
the
> same Form Format that the individual sees on the Inertnet when the info is
> input into the Form ( the form boxes and spacing etc.), rather than just
the
> text, which is a little harder to follow than info in a form.

> An alternative, would be to format the information sent in the e-mail so
> that I can bold/change font size/underline etc certain headings that are
> sent in the e-mail.

> Can anyone provide any suggestions for either of the above approaches?

> Thanks in advance.

> Evan

============================================================================

- Show quoted text -

Quote:
> ========

> <%
>  requestType = Request.Form("requestType")

>  if(requestType = "sendmail") then
>   fName = Request.Form("fName")
>   fDistance = Request.Form("fDistance")
>   fLocation = Request.Form("fLocation")
>   fYourName = Request.Form("fYourName")
>   fYourEmail = Request.Form("fYourEmail")
>   fEmail = Request.Form("fEmail")
>   error = 0
>   message = "<center><p><font color=#dbdb70><b>Error! Please fill in:<font
> color=#ff0000><br>"

>   if(fPatientName = "") then
>    error = 1
>    message = message & "Patient's name<br>"
>   end if
>   if(fDrug = "") then
>    error = 1
>    message = message & "Drug Information<br>"
>   end if
>   if(fLocation = "") then
>    error = 1
>    message = message & "Patient's Location<Br>"
>   end if
>   if(fYourName = "") then
>    error = 1
>    message = message & "Your Name<Br>"
>   end if
>   if(fYourEmail = "") then
>    error = 1
>    message = message & "Your e-mail<br>"
>   end if
>   if(fEmail = "") then
>    error = 1
>    message = message & "My e-mail<br>"
>   end if

>   message = message & "</b></font></font></p><br></center>"

>   if(error <> 1) then
>    body = "Name:" & fName & "" & vbCrLf & vbCrLf
>    body = body & "Location:" & fLocation & "" & vbCrLf & vbCrLf
>    body = body & "Distance:" & fDistance & "" & vbCrLf & vbCrLf
>    body = body & "Your Name:" & fYourName & "" & vbCrLf & vbCrLf
>    Set objMail = CreateObject("CDONTS.NewMail")
>    objMail.To = fEmail
>    objMail.From = fYourEmail
>    objMail.Subject = "Distance Traveled Information"
>    objMail.Body = body
>    objMail.Send
>    Set objMail = Nothing

>    message = "<p><center><font color=#dbdb70><H3><b>Message has been sent
> succesfully!</b></H3></font></center></p><br>"
>   end if

>  end if
> %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META content="text/html; charset=windows-1252" http-equiv=Content-Type>
> <META content="MSHTML 5.00.3207.2500" name=GENERATOR></HEAD>
> <BODY bgColor=floralwhite><FONT color=black>

> <FORM action=test2.asp method=post name=DistanceForm>
> <TABLE border=0 cellPadding=2 cellSpacing=2>
>   <TBODY>
>   <TR>
>     <TD colSpan=3><%=message%></TD>
>   <TR>
>     <TD align=left vAlign=center><FONT color=black
>       face=arial,geneva,helvetica,sans-serif size=3><B>Name</B></FONT>
</TD>
>     <TD align=left vAlign=center><B><INPUT maxLength=50 name=fName
>       size=32></B> </TD></TR>
>   <TR>
>     <TD align=left vAlign=center><FONT color=black
>       face=arial,geneva,helvetica,sans-serif size=3><B>Location</B></FONT>
> </TD>
>     <TD align=left vAlign=center><B><INPUT maxLength=50 name=fLocation
>       size=32></B> </TD></TR>
>   <TR>
>     <TD align=left vAlign=center><FONT color=black
>       face=arial,geneva,helvetica,sans-serif size=3><B>Distance
> Information</B></FONT> </TD>
>     <TD align=left vAlign=center><B><INPUT maxLength=50 name=fDistance
>       size=32></B> </TD></TR>
>   <TR>
>     <TD align=left vAlign=center><FONT color=black
>       face=arial,geneva,helvetica,sans-serif size=3><B>Your
Name</B></FONT>
> </TD>
>     <TD>
>     <SELECT NAME="fYourName" SIZE=1>
>      <OPTION VALUE="">
>      Click to Select Your Location
>     <OPTION VALUE="Nurse 1">Name 1
>     <OPTION VALUE="Nurse 2">Name 2
>     <OPTION VALUE="Nurse 3">Name 3
>     </SELECT>
>     </TD></TR>
>  <TR>
>     <TD align=left vAlign=center><FONT color=black
>       face=arial,geneva,helvetica,sans-serif size=3><B>Your e-Mail
> Address</B></FONT> </TD>
>     <TD>
>     <SELECT NAME="fYourEmail" SIZE=1>
>      <OPTION VALUE="">
>      Click to Select Your e-Mail Address




>     </SELECT>
>  </TD></TR>
>   <TR>
>     <TD align=left vAlign=center><FONT color=black
>       face=arial,geneva,helvetica,sans-serif size=3><B>Send Request To
>  </B></FONT> </TD>
>     <TD>
>     <SELECT NAME="fEmail" SIZE=1>
>      <OPTION VALUE="">
>      Click to Select Location To Send To




>     </SELECT>
>  </TD>
>   </TR>
>   <TR>
>     <TD colSpan=3>&nbsp;<BR><INPUT name=Submit type=submit value="Send"
> ALIGN="MIDDLE">
>     </TD></TR></FONT></TBODY></TABLE>
>     <input type=hidden name=requestType value="sendmail">

>     </FORM></FONT></BODY></HTML>



Sat, 30 Aug 2003 23:55:14 GMT  
 Format Info From a Form in a ASP File To Be Sent In An e-Mail

Michael:

thanks a lot for your help.

Evan

  BodyFormat Property (CDONTS NewMail Object)
  http://msdn.microsoft.com/library/psdk/cdo/_denali_bodyformat_propert...

  --
  Michael Harris
  Microsoft.MVP.Scripting
  --

  Please do not email questions - post them to the newsgroup instead.
  --


  > Hi:
  >
  > I have the following file that (when actual e-mail addresses are used) sends
  > the info input into the form in an e-mail to the appropriate address. The
  > information in the e-mail is just straight text.
  >
  > What I would like to do is to have the information sent in the e-mail in the
  > same Form Format that the individual sees on the Inertnet when the info is
  > input into the Form ( the form boxes and spacing etc.), rather than just the
  > text, which is a little harder to follow than info in a form.
  >
  > An alternative, would be to format the information sent in the e-mail so
  > that I can bold/change font size/underline etc certain headings that are
  > sent in the e-mail.
  >
  >
  > Can anyone provide any suggestions for either of the above approaches?
  >
  > Thanks in advance.
  >
  > Evan
  >
  > ============================================================================
  > ========

  > <%
  >  requestType = Request.Form("requestType")
  >
  >  if(requestType = "sendmail") then
  >   fName = Request.Form("fName")
  >   fDistance = Request.Form("fDistance")
  >   fLocation = Request.Form("fLocation")
  >   fYourName = Request.Form("fYourName")
  >   fYourEmail = Request.Form("fYourEmail")
  >   fEmail = Request.Form("fEmail")
  >   error = 0
  >   message = "<center><p><font color=#dbdb70><b>Error! Please fill in:<font
  > color=#ff0000><br>"
  >
  >   if(fPatientName = "") then
  >    error = 1
  >    message = message & "Patient's name<br>"
  >   end if
  >   if(fDrug = "") then
  >    error = 1
  >    message = message & "Drug Information<br>"
  >   end if
  >   if(fLocation = "") then
  >    error = 1
  >    message = message & "Patient's Location<Br>"
  >   end if
  >   if(fYourName = "") then
  >    error = 1
  >    message = message & "Your Name<Br>"
  >   end if
  >   if(fYourEmail = "") then
  >    error = 1
  >    message = message & "Your e-mail<br>"
  >   end if
  >   if(fEmail = "") then
  >    error = 1
  >    message = message & "My e-mail<br>"
  >   end if
  >
  >   message = message & "</b></font></font></p><br></center>"
  >
  >   if(error <> 1) then
  >    body = "Name:" & fName & "" & vbCrLf & vbCrLf
  >    body = body & "Location:" & fLocation & "" & vbCrLf & vbCrLf
  >    body = body & "Distance:" & fDistance & "" & vbCrLf & vbCrLf
  >    body = body & "Your Name:" & fYourName & "" & vbCrLf & vbCrLf
  >    Set objMail = CreateObject("CDONTS.NewMail")
  >    objMail.To = fEmail
  >    objMail.From = fYourEmail
  >    objMail.Subject = "Distance Traveled Information"
  >    objMail.Body = body
  >    objMail.Send
  >    Set objMail = Nothing
  >
  >
  >    message = "<p><center><font color=#dbdb70><H3><b>Message has been sent
  > succesfully!</b></H3></font></center></p><br>"
  >   end if
  >
  >  end if
  > %>
  > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  > <HTML><HEAD>
  > <META content="text/html; charset=windows-1252" http-equiv=Content-Type>
  > <META content="MSHTML 5.00.3207.2500" name=GENERATOR></HEAD>
  > <BODY bgColor=floralwhite><FONT color=black>
  >
  > <FORM action=test2.asp method=post name=DistanceForm>
  > <TABLE border=0 cellPadding=2 cellSpacing=2>
  >   <TBODY>
  >   <TR>
  >     <TD colSpan=3><%=message%></TD>
  >   <TR>
  >     <TD align=left vAlign=center><FONT color=black
  >       face=arial,geneva,helvetica,sans-serif size=3><B>Name</B></FONT> </TD>
  >     <TD align=left vAlign=center><B><INPUT maxLength=50 name=fName
  >       size=32></B> </TD></TR>
  >   <TR>
  >     <TD align=left vAlign=center><FONT color=black
  >       face=arial,geneva,helvetica,sans-serif size=3><B>Location</B></FONT>
  > </TD>
  >     <TD align=left vAlign=center><B><INPUT maxLength=50 name=fLocation
  >       size=32></B> </TD></TR>
  >   <TR>
  >     <TD align=left vAlign=center><FONT color=black
  >       face=arial,geneva,helvetica,sans-serif size=3><B>Distance
  > Information</B></FONT> </TD>
  >     <TD align=left vAlign=center><B><INPUT maxLength=50 name=fDistance
  >       size=32></B> </TD></TR>
  >   <TR>
  >     <TD align=left vAlign=center><FONT color=black
  >       face=arial,geneva,helvetica,sans-serif size=3><B>Your Name</B></FONT>
  > </TD>
  >     <TD>
  >     <SELECT NAME="fYourName" SIZE=1>
  >      <OPTION VALUE="">
  >      Click to Select Your Location
  >     <OPTION VALUE="Nurse 1">Name 1
  >     <OPTION VALUE="Nurse 2">Name 2
  >     <OPTION VALUE="Nurse 3">Name 3
  >     </SELECT>
  >     </TD></TR>
  >  <TR>
  >     <TD align=left vAlign=center><FONT color=black
  >       face=arial,geneva,helvetica,sans-serif size=3><B>Your e-Mail
  > Address</B></FONT> </TD>
  >     <TD>
  >     <SELECT NAME="fYourEmail" SIZE=1>
  >      <OPTION VALUE="">
  >      Click to Select Your e-Mail Address




  >     </SELECT>
  >  </TD></TR>
  >   <TR>
  >     <TD align=left vAlign=center><FONT color=black
  >       face=arial,geneva,helvetica,sans-serif size=3><B>Send Request To
  >  </B></FONT> </TD>
  >     <TD>
  >     <SELECT NAME="fEmail" SIZE=1>
  >      <OPTION VALUE="">
  >      Click to Select Location To Send To




  >     </SELECT>
  >  </TD>
  >   </TR>
  >   <TR>
  >     <TD colSpan=3>&nbsp;<BR><INPUT name=Submit type=submit value="Send"
  > ALIGN="MIDDLE">
  >     </TD></TR></FONT></TBODY></TABLE>
  >     <input type=hidden name=requestType value="sendmail">
  >
  >     </FORM></FONT></BODY></HTML>
  >
  >



Sun, 31 Aug 2003 09:54:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Update : Format Info From a Form in a ASP File To Be Sent In an e-Mail

2. Automating sending mail using email adress from file

3. is there anyway to send an email through the browser (form) without launching the email client

4. I want to send mail in WSH with JScript source...What am I doing wrong

5. I want to send mail in WSH with JScript source...What am I doing wrong

6. email me ny vbs scripts i am making a huge prog with any features u send

7. email me ny vbs scripts i am making a huge prog with any features u send

8. script which send an email to an email adress, with file attached

9. Save flagged email as file but send out unflagged email

10. Sending HTML format in Email messages using SMTP prototocal

11. Sending Mail in HTML Format

12. Send info from only the current record in an email

 

 
Powered by phpBB® Forum Software