[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASPMailer AddAttachment from Web Form

Posted on 2004-04-17
3
Medium Priority
?
386 Views
Last Modified: 2008-02-26
Hello,

Using a Web form I have a field that allows a user to attach a file and upon submit an email is generated and the file is attached to that email.  But I am receiving an error - The Path parameter for the MapPath method must be a virtual path. A physical path was used.

Here is my code:

<%
  Dim Name
  Dim EMail
  Dim Phone

  Name = Request.Form("txtfName")
  EMail = Request.Form("txtemail")
  Phone = Request.Form("txtPhone")
  file = Request.Form("fResume")

  Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
  Mailer.FromName   = Name
  Mailer.FromAddress = Email
  Mailer.RemoteHost = "mail.website.com"
  Mailer.AddRecipient "info@website.com", "info@website.com"
  Mailer.Subject = "Submitted file"
  Mailer.AddAttachment (Server.MapPath(file))
  Mailer.ContentType = "text/html"
  Mailer.BodyText = "<html><body>Hello You, <br>" & Name & " is interested in the following:  Attached is their document<BR></body></html>"

  strMsgFooter = vbCrLf & "End Of Information Sent"
  Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter


  if Mailer.SendMail then
      Response.Write ""
  else
      Response.Write "<FONT COLOR='red'>Mail send failure. Error was</FONT> " & Mailer.Response
  end if

%>
0
Comment
Question by:rudyflyer
  • 2
3 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10849896
I don't think that will work. In order for ASPeMail to send the attachment, it has to exist on the server, not the client. Sio, what you have to do is to upload the attachment to the server first and then send the attachment.

Fritz the Blank
0
 

Author Comment

by:rudyflyer
ID: 10849992
How would I do that?
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 1000 total points
ID: 10850024
You will need to have some sort of upload component or to use a pure code (i.e., no component) solution. Here are a few to get you started:

components:

http://www.aspupload.com/
http://aspalliance.com/dundas/default.aspx
http://fileup.softartisans.com/fileup-131.aspx

code only:

http://www.asp101.com/articles/jacob/scriptupload.asp#buffering

Fritz the Blank
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month19 days, 3 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question