[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

JMail Issue

Posted on 2003-12-10
5
Medium Priority
?
587 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
[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
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

650 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