Solved

JMail Issue

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
File download script VBSCRIPT fail on download PPT files 2 75
Downside of adding characters set in ASP pages 6 40
VBScript on Html 15 64
Compress Newid value ms sql Mssql 4 41
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…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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