Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 15th, 2014, 03:11 PM
Authorized User
 
Join Date: Sep 2004
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default Add Attachments to Classic ASP e-mail program

Good afternoon.

Ten years ago, I created a classic asp program which sends e-mails to my users and it had been working fine. Via this program, I can also "add" attachments (which reside on my web server) to e-mails via the code below.

<input name=fleAttach1 type=file size=70 maxlength=100>

There are three problems with this approach:

1) It doesn't work with FireFox or Chrome: I receive the "fakePath" message when attempting to attach the files.

2) It doesn't work in IE, on occasion, if IE settings are incorrect.

3) I need to be on my network in order to point to files on my webserver.

I need a new approach to attaching files to my classic asp e-mail program.

What would you recommend.

Thank you for your help!

Sal
 
Old January 15th, 2014, 03:55 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I think you'll need to post the relevant pieces of your code, or it'll be hard to suggest a solution.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 15th, 2014, 04:06 PM
Authorized User
 
Join Date: Sep 2004
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Imar,

Thank you for your response.

I use a single line of code to retrieve the file name to be "attached" to the e-mail:

<input name=fleAttach1 type=file size=70 maxlength=100>

I use a simple javaScript edit to verify the file resides on my web server.

I then submit the form and asp sends the e-mail and attachment (which works fine).

I'm looking for a totally different approach since type=file does not work with properly with Chrome or FireFox: it does not allow me to view the entire file name and determine if does reside on my webserver.

Can you recommend some sort of utility that I can plug into my asp program which will allow my users to attach and e-mail files just as in a tradition e-mail clients like gmail, etc.?

Thank you.

Sal
 
Old January 15th, 2014, 04:22 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

That can't have been all of it, I assume? That just works on the client and you would have no access to the path on the server where ASP runs. Or did you only use this on your own environment? If not, there must have been some code that uploads and attaches the file on the server side.

The full path is no longer exposed by the browser as that exposed too much information. However, the file, and file name are still available. If you use an external upload component (like a third party COM object or one of the available free "Pure ASP" upload scripts) you should be able to save the file using the original name, and attach it to an e-mail.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 15th, 2014, 04:37 PM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp uploader

have you tried http://aspuploader.com/??

I use this.. flawless. works in all browsers.

a complete alternative for you.
 
Old January 15th, 2014, 04:45 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I think this is a better option:

http://www.persits.com/

if you use this component it does all sorts of different things. FileUplods and Email Attachments are only two of the features you will get.

As Imar mentioned there is a great pure ASP upload on this site somewhere. I did try to search for it however I couldn't find it quickly and I am a bit busy to keep looking.

While looking I noticed if you use the search without logging it it fails to give results.
__________________
Wind is your friend
Matt
 
Old January 15th, 2014, 04:50 PM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Try this emailer with attachment. so simple!

<code>
<%
Dim myMail

Set myMail = Server.CreateObject("CDO.Message")

With myMail ' Set message attributes
myMail.Subject = "my attachment"
myMail.From = "[email protected]"
myMail.To = "[email protected]"
Mymail.htmlBody = "Attached is my file"
'Mymail.TextBody = "Attached is my file"

' Attachment using known static physical path
'.AddAttachment "c:\somepath\somefile.txt"

' Attachment using mappath to find the physical path
.AddAttachment Server.MapPath("foldername/filename.xls")


' Send message - uncomment the following line only
' AFTER you've entered appropriate To and From
' addresses above. Then the script will actually
' send the messages.
'Send
End With
myMail.Send

Set objMessage = Nothing
%>
</code>





Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Import E-Mail using Classic Asp? may29adil All Other Wrox Books 0 September 29th, 2008 07:20 AM
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
Mail with Attachments software_developer_kk Classic ASP Basics 1 March 31st, 2005 12:34 AM
ASP program How to add new ID for new record kinshuk SQL Server ASP 3 March 21st, 2005 02:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.