Solved

JMail Issue

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

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…
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/…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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