Solved

JMail Issue

Posted on 2003-12-10
5
560 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now