Solved

ASPMailer AddAttachment from Web Form

Posted on 2004-04-17
3
364 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 250 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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