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
Solved

ASPMailer AddAttachment from Web Form

Posted on 2004-04-17
3
354 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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
sql to convert to date IF entry is in date format 4 93
ASP Button to clear text 4 62
RegEx Help - open to other simple suggestions 8 58
FileUp - Classic ASP 5 20
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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