Link to home
Start Free TrialLog in
Avatar of FalconUK
FalconUKFlag for United Kingdom of Great Britain and Northern Ireland

asked on

JMail attachments not appearing correctly in Outlook

I'm trying to send a mail using JMail 4.4 and I'm having a big problem with Outlook.  Internet mail clients do not show this behaviour.

The email is arriving at the destination, but the attachment is not 'attaching' correctly.  The email in Outlook (2002 & XP) does not show the paperclip next to the mail icon to indicate there is an attachment, but if you select the file menu, then Save Attachments> you get a 'None' menu item (and not the correct filename), but if you select this you get the save as dialog with the correct file name, and the attachment is saved correctly.
I've tried all sorts of Content-Types to get the email to show up as having an attachment, but with little sucess.

The attachment is a very small zip file, although it doesn't matter what I attach, the results are the same.

If I specify the Content-Type of the JMail as "text/plain", "text/html", "multipart/mixed" I get no paperclip icon.
This is the code I'm using:

<%
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.Logging = True
JMail.ServerAddress = "myhost.net"
JMail.Sender = "chris@nospam.com"
JMail.SenderName = "ChrisB
JMail.Subject = "Code"
JMail.AddRecipient "chris@nospam.com"
JMail.ISOEncodeHeaders = False
JMail.ContentType = "multipart/mixed"
JMail.Body = "Does it work?"
JMail.AddAttachment Server.MapPath("code1.zip")
JMail.Execute
Set JMail = Nothing
%>

If I wrongly specify the email Content-Type as "application/x-zip-compressed" (just to see what happens) I do get my paperclip icon, but I get two corrupt code.zip (not code1.zip) attachments.  And these are corrupt as they have the first text email part with MIME header in the saved zip file.

I think I've tried every combination of content-types, both for the JMail.ContentType and the AddAttachment "code1.zip", Content-Type, and cant get this to work.
This is the raw content of an email sent with multipart/mixed for the email content type, and application/x-zip-compressed for the attachment, which doesnt show up as having an attachment in Outlook, but works fine in my internet browser mail (SmarterMail Pro 2.0)

...HEADERS...
Subject: Code
Sender: "Chris Website" <chrisweb@nospam.com>
From: "Chris Website" <chrisweb@nospam.com>
Date: Fri, 15 Oct 2004 11:06:55 +0100
To: "chris@nospam.com" <chris@nospam.com>,
"chris@nospam.com" <chris@nospam.com>
X-Priority: 3
X-MSMail-Priority: Normal
MIME-Version: 1.0
X-Mailer: JMail 4.4 by Dimac
Content-Type: multipart/mixed;
boundary="--NEXT_BM_47AF7764AA5E46A99C4311D7F3057119"
Message-Id: <20041015100655.C623C214BB9@mxhost-1.vi.net>
Virtual_Internet-SpamScore: s
Virtual_Internet-From: chris@nospam.com

This is a multipart message in MIME format.
----NEXT_BM_47AF7764AA5E46A99C4311D7F3057119
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: Quoted-Printable

Does it work=3F

----NEXT_BM_47AF7764AA5E46A99C4311D7F3057119
Content-Type: application/x-zip-compressed; name="code1.zip"
Content-Transfer-Encoding: base64
Content-Description: code1.zip
Content-Disposition: attachment; filename="code1.zip"
Content-ID: <8E242FFFAA4F4F43B6A73C1EDFA84822>

UEsDBBQAAAAIALFsSzEctpM4rwIAACYGAAAIAAAAY29kZS50eHS9VG1v2jAQ
..ETC...
toEAAAAAY29kZS50eHRQSwUGAAAAAAEAAQA2AAAA1QIAAAAA


----NEXT_BM_47AF7764AA5E46A99C4311D7F3057119--


I need to get this fixed asap as this is a component that will be serving my customers with files from the site, and getting this working in Outlook is a must!

Please help, I'm going Content-Type insane with all this.

Cheers,
Chris.
Avatar of sajuks
sajuks

what happens if you dont specify he contenttype ie
<%
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.Logging = True
JMail.ServerAddress = "myhost.net"
JMail.Sender = "chris@nospam.com"
JMail.SenderName = "ChrisB
JMail.Subject = "Code"
JMail.AddRecipient "chris@nospam.com"
JMail.ISOEncodeHeaders = False
JMail.Body = "Does it work?"
JMail.AddAttachment Server.MapPath("code1.zip")
JMail.Execute
Set JMail = Nothing
%>
Avatar of FalconUK

ASKER

I get no paper clip, but I can save the file correctly by File > Save Attachments > None.
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That sounds like what I need but apparently I dont have that method, even though JMail.Version shows 4.4???

Can I add this header myself to the mail object?
Nope not unlesss you have the proper version.4.4
Right click on the jmail dll and view the version iyou've.
Listening ...
Got the same problem, couldn't find a way to solve it for the moment.
Any solution gets 500 more points from me ...
Just logged a support call with my ISP to upgrade the JMail component to the lastest version.

I'm waiting to hear back from them...fingers crossed!

Interesting enough, MS seam to be aware of this problem...
http://support.microsoft.com/kb/313316/EN-US/
They claim v4.4 has solved the above problem.

From the dimac website http://www.dimac.net/
----------------------------------------------------------------------------------------------------------------------------------------
Q: When I attach files to my HTML mails, the attached files just look like this:

This is a multipart message in MIME format. ----NEXT_BM_2D86444211634CEF8F266D5AC452437C Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: Quoted-Printable body text ----NEXT_BM_2D86444211634CEF8F266D5AC452437C Content-Type: application/octet-stream; name="=?iso-8859-1?Q?help=2Egif?=" Content-Transfer-Encoding: base64 Content-Description: =?iso-8859-1?Q?help=2Egif?= Content-Disposition: attachment; filename="=?iso-8859-1?Q?help=2Egif?=" Content-ID: R0lGODlhEAAQAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwMDcwKbK8EBC SkFETEJFTUNGTUVIT0lMVExOWFJWX1peaFteaV1hbGFlb2RqdmhseAAwvQtF uAxFuw1IvRBHuRVMtyRWuTxkuQ9KwQ9KxBBLwRNOxhtTwxpTxx9VxB5WxRlU yRRT0SNYwCFYySNayiNbyyBazSFazCJbzSZcyitewylexildySheyihfyyle...

A: Try removing this line:
    JMail.ContentType = "text/html"

and just use:
    JMail.Body = "..." (for the plain text version)
    JMail.HTMLBody = "..." (for the html version)


----------------------------------------------------------------------------------------------------------------------------------------
 New in v 4.4:

- Some issues regarding incorrect handling of attachments in
 POP3 were fixed.

- An issue which sometimes generated an error when iterating
 multiple attachments were fixed.

- The property "NoAutoContentID" was added to the message object. If set to true, no Content-ID header will be generated for regular attachments. For inline attachments, the header is still set. This can be used to solve some attachment problems occuring with certain email-clients. The default value is false.

FYI
I upgraded to 4.4 and tried NoAutoContentID = true

Still getting a "None" in the Save Attachments menu :-(
Just had an email from my ISP.

They are not prepared to upgrade the JMail component anyway.

Security issues, compatibility issues, effects on other customers and licencing were their reasons.

Does anyone have any other ideas on this one?
Try some other mail client dll like funcky or aspemail ?
This was my web site hosts reply:

Your welcome to try other mailing scripts that can be downloaded on the Internet and uploaded to your website, however we can't give you any assistance if you have trouble configuring the script nor can we guarantee this will work on our servers.

So can anyone recomend something they use them selves, something easy to setup?
I'm guessing that I need something different than products like JMail, as this needs to be installed my hosts servers, and this isnt going to happen.
Are there any scripts out there that I can use that dont require me to install anything on their server?

All I want to do is send emails with attachements!

Chris.
What server side scripting language do they support ? if you use php or cgi for example there are lots of mail classes that you could use for your requirement
I'm sure that sajuks second answer would of worked, but I have no way of testing this.

So I am no longer sending emails with attachments.

I didn't want to accept this answer without testing it, although I'm sure it true as I have read on a few more web sites about it.