Solved

JMail Issue

Posted on 2003-12-10
5
569 Views
Last Modified: 2008-02-26
Hello,

I have a form, which accepts a file through an a browse option (<input type="file" name="planattachment">) and when the form is submitted, I want that file to be sent as an attachment using JMail.

Here's the code I have at the moment:

-----------------------------------------------------------
'Dimension variables
Dim objJMail 'Holds the JMail Object

'Create the e-mail server object
Set objJMail = Server.CreateObject("JMail.Message")

'Senders email address
objJMail.From = bill@mail.com

'Senders name
objJMail.FromName = "Referral"

'Who the email is sent to
objJMail.AddRecipient joe@mail.com

'Set the subject of the e-mail
objJMail.Subject = "Client Referral from Bill"

objJMail.HTMLBody = "blah"

'Importance of the e-mail (5=Low, 3=Normal, 1=High)
objJMail.Priority = 3

objJMail.AddAttachment(Request.Form("attachment"))

'Send the e-mail
objJMail.Send("smtp.mailserver.com")

'Close the server object
Set objJMail = Nothing
--------------------------------------------------------------

I have this strange feeling in the back of my mind that I need to upload the file first, before I am able to send if off as an attachment.  But I remember reading somewhere that it was possible without storing the file on the server......

The error that occurs is like "could not open file <filepath&name>"

Any help would be appreciated

Thanks in advance.
0
Comment
Question by:Sebastion
  • 2
5 Comments
 
LVL 3

Expert Comment

by:rajuare
ID: 9927631
Like that u've to add the attachment file in Jmail.

mailer.addattachment (server.MapPath("topban1.gif"))
0
 

Author Comment

by:Sebastion
ID: 9931938
I already have the addattachment code in there (objJMail.AddAttachment(Request.Form("attachment"))) and I've been able to send attachments before.  But in the past, I have never needed to get the attachment from the person.  

Before, I always had the attachment on the server, so sending it was fine.  This time, however, the form which preceeds the JMail code gives the user an option to select a file which they want to put as an attachment on the email (<input type="file" name="planattachment">).  When the form is submitted, I can get the full path of that file (which is on their local machines) from the form (Request.Form("attachment")).
0
 

Author Comment

by:Sebastion
ID: 9946035
I finally managed to work something out, which meets my needs (but stilll not sure if its possible to send an attachment directly from the users local machine).

Using code which I found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasdj01/html/asp0900.asp I managed to upload the users file to the server, from which I pointed the attachment to that file and then deleted the file off the server.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9969596
PAQed, with points refunded (50)

Computer101
E-E Admin
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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 information …
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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