?
Solved

ASPMailer AddAttachment from Web Form

Posted on 2004-04-17
3
Medium Priority
?
374 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

777 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