Print Page | Close Window

Form Help Required

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=9493
Printed Date: 28 March 2026 at 6:06am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Form Help Required
Posted By: davide
Subject: Form Help Required
Date Posted: 03 February 2004 at 6:03am

Hope you may help.

I have a form on my page and would like to attach files to the form and mail them to me. The script I have for the form is:

<form action="D2sendmail.asp" method="post" name="form1">
<input name="fmname" type="text" class="textboxes" id="fmname" size="45">
<input name="fmemail" type="text" class="textboxes" id="fmemail" size="45">
<textarea name="fmquestion" cols="39" rows="5" class="textboxes" id="fmquestion"></textarea>
<input type=file name="browse">
</form>

This displays correctly but when I send it it sends all the other information except my attached file. The processing page I have for the form is shown below:

Dim HTML
    HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
    HTML = HTML & "<html>"
    HTML = HTML & "<head>"
    HTML = HTML & "<meta http-equiv=""Content-Type"""
    HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
    HTML = HTML & "<meta name=""GENERATOR"""
    HTML = HTML & " content=""Microsoft Visual Studio 6.0"">"
    HTML = HTML & "<title>HTMLMail</title>"
    HTML = HTML & "</head>"
    HTML = HTML & "<body bgcolor=""edefea"">"
    HTML = HTML & "<font color=#000099 size=3 face=Arial, Helvetica, sans-serif>"
  HTML = HTML & "<p></p>"
  HTML = HTML & "<b>Message from:</b> " & request.Form ("fmname")
 HTML = HTML & "<p></p>"
 HTML = HTML & "<b>Users email:</b> " & request.Form("fmemail")
 HTML = HTML & "<p></p>"
 HTML = HTML & "<b>Message text:</b> " & request.Form("fmquestion")
 HTML = HTML & "<p></p>"
 HTML = HTML & "<b>File:</b> " & request.Form("file")
 HTML = HTML & "<p></p>"
 HTML = HTML & "<b>Date/Time:</b> " & now()
 HTML = HTML & "<p></p>"
 HTML = HTML & "<b>Users IP address:</b> " & request.ServerVariables("REMOTE_ADDR")
 HTML = HTML & "<p></p>"
 HTML = HTML & "<b>****** END OF MESSAGE ******</b></font> "
    HTML = HTML & "</body>"
    HTML = HTML & "</html>"

  Dim D2Mail
   Set D2Mail = CreateObject("CDONTS.NewMail")
    D2Mail.From= request.Form("fmEmail")
    D2Mail.To= mailaddr
    D2Mail.Subject="Mail from " & sitesname & " website contact form"
    D2Mail.BodyFormat=0
    D2Mail.MailFormat=0
    D2Mail.Body=HTML
    D2Mail.Send
 
 set HTML = nothing
    set D2Mail=nothing

I know it will probable be something I have forgotten to add in or something. Any help on this is greatly appreciated


Thanks




Replies:
Posted By: mobious
Date Posted: 03 February 2004 at 1:12pm

This might help

http://www.webmasterworld.com/forum47/274.htm - http://www.webmasterworld.com/forum47/274.htm



Posted By: Bullschmidt
Date Posted: 05 February 2004 at 6:53am

I don't see where you're telling the D2Mail object what the attached files are to be.

You may want to check this resource out:

http://www.asp101.com/samples/email_attach.asp - http://www.asp101.com/samples/email_attach.asp



-------------
J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com - www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net