Web link to EML file

  • Thread starter Thread starter Stingray
  • Start date Start date
S

Stingray

I think this is more of a general IE/HTTP question but I didn't know where
to post. If this is not the place for it, please point me to the right
group. Thanks. Here's my question:

I have an application that reads incoming email from a POP server and saves
email messages as EML files, which OE can open and read. I'd like to save
these files to a directory on a web server and create a web page that
provides links to these files. When a link is clicked, I would like OE to
open the message. Right now, what happens is IE redirects me to the URL of
the file with "mhtml:" prepended to it (for example:
mhtml:http://foo.com/myfile.eml") and tells me the page cannot be found. I
tried creating a page that writes the contents of this file to the response
stream and set the content type to "message/rfc822" but that gives me the
sme result (redirect to mhtml:http://...). My guess is IE is trying to be
all things to all people and open it itself, but doesn't know how. Can
someone tell me how to get IE to download the file and open it in OE
instead?

Thanks,
John
 
If you rename an EML with an MHT extension, it will open natively in
Internet Explorer (not Outlook Express).

Without looking at how your application handles (processes) the incoming
mail, it's hard to be more helpful.
 
One of the security features introduced in IE6 SP1 or subsequently will no
longer allow IE to open eml files. So you have to rename them as mht as Jim
suggested to get them to display in IE.

There are ways around this if you are using an ASP or ASPX page.

steve
 
Thank you Jim and Steve.

Jim: The app simply writes an entire email message to a file in EML format,
just as if an email was dragged out of OE into a folder. The file opens
properly in OE.

Steve: You mentioned a way around this. I can use ASP or ASP.NET (prefer
the latter). This is an intranet site so I don't need to worry too much
about security. Files are cleaned by NAV before being opened.

Changing the extension to MHT allowed them to be viewed in IE. But I need
them to be opened by OE not IE so the user can reply. So how do I get
around this security thing and get the file sent to OE? Actually, I would
prefer to use Outlook, but from what I've been told this is not at all
possible.

Thanks again,
John
 
Stingray said:
Thank you Jim and Steve.

Jim: The app simply writes an entire email message to a file in EML format,
just as if an email was dragged out of OE into a folder. The file opens
properly in OE.

Steve: You mentioned a way around this. I can use ASP or ASP.NET (prefer
the latter). This is an intranet site so I don't need to worry too much
about security. Files are cleaned by NAV before being opened.

Changing the extension to MHT allowed them to be viewed in IE. But I need
them to be opened by OE not IE so the user can reply. So how do I get
around this security thing and get the file sent to OE? Actually, I would
prefer to use Outlook, but from what I've been told this is not at all
possible.

I was thinking you could write the whole message as a response.write
(re-reading your message, it seems you already tried that and setting the
content-type). But that won't open the message in OE. You could grab the
reply-to address and make a mailto link with the subject and stuff, but that
wouldn't include the original message in reply.

I don't think there is anyway to get the message to open in OE from the NET,
as OE is not programmable and they apparently blocked the mshtml: URL
capability.

I'll think about it, but I think you are stuck.

cheers,

steve
 
Oh well it was worth a shot. What I'm doing right now is just displaying
the body text on a page and saving attachments to files that can be
downloaded and opened. I'm using a 3rd party package from Chilkat to
actually pull the mail from the server. When I saw this package had the
ability to write EML files I was ecstatic, until I hit the brick wall.
Saving these as MHT and opening them in IE is definitely a lot nicer looking
and easier than what I was previously doing. So that helped a lot. For
replies I'm using a mailto and passing the subject and body as parameters,
but there's a limit to the length of these parameters. So I figured if I
could open with OE, that would solve all my problems. Well, at least this
method allows Outlook to be used, since the mailto opens the user's default
mail client (in our case, Outlook).

I'll keep a watch on this thread. If you come up with anything else that
might help let me know. Thanks again Steve. And you too Jim.

John
 
Changing the extension to MHT allowed them to be viewed in IE.
But I need them to be opened by OE not IE so the user can reply.

If you can open the file in IE you should be able to send it to OE
(Tools, Mail..., Send Page...)

In fact, after a recent patch this seems to be the only way to save
some pages now. File, Save As...,Web Achive frequently fails
but sending them to OE and saving it there as .mht often works.

I haven't seen anything yet to know if this is an intended new restriction
(e.g. an unavoidable consequence of a security change) or a bug which
eventually may be fixed.


YMMV

Robert Aldwinckle
 
Thank you Robert for your reply. This doesn't seem to work as you would
expect. It attaches an mht file as an attachment named "Message" with no
extension rather than putting it in the body as it does with HTML. Even if
it worked, this is not exactly the behavior I was looking for. I'd like the
user to click a link and not rely on them knowing how to use the browser
functions. But thanks for your help.

John
 
You could put a url there to the actual eml file and the user could right
click on it and choose Save Target to get the actual eml file for OE to open
on their machine. In addition to having the mht viewed in IE.

It sounds like you have half a mail client built. You could just build the
other half. <G>

steve
 
"Stingray" <nospam> wrote in message
....
Thank you Robert for your reply. This doesn't seem to work as you would
expect. It attaches an mht file as an attachment named "Message" with no
extension rather than putting it in the body as it does with HTML.

Oh. Ok. That sort of makes sense. Actually I only knew that this worked
for .htm or .asp pages.

I jumped into this thread in the middle and now see that you are actually
starting from an .eml file. If I had realized that I wouldn't have made
my comment. Sorry for the interruption.

I notice that you would prefer to use Outlook but say that you were told
that this is not possible. I just did a Google Groups search and notice
that though you asked the question in outlook.vba you didn't get any replies.
Presumably you got some offline replies? Why not run your *requirements*
by an Outlook NG and see what ideas they come up with.
It's possible that by having chosen an implementation you are unnecessarily
restricting yourself from a solution since Outlook is programmable.


Robert
---
 
Steve,
Yes, I could do that. But then I'd have to train users to do this. There
will still be those who click the link and report a bug that the link
doesn't work. You know how users are. As I always say, if it weren't for
users, the software would work perfectly!
John
 
Robert,

I was told by Chilkat (the company that wrote the email component I'm using)
that they would love to support Outlook integration but they looked into it
and it is not easily done. They said it theoretically could be done with
C++ and Extended MAPI. Neither of those scare me, but I can't find any info
anywhere to substantiate that. Also, Outlook uses an undocumented message
file format (.msg) so there's no way to create a file and have Outlook open
it. I can't find any APIs available for creating an Outlook email message
and populating it with data, only for opening existing ones. And no
response from that newsgroup leads me to believe there really is no way to
do this. I suppose I could post to a few other Outlook groups and reword
the question. Maybe I just need a better subject line to get their
attention. Something like: "WIN BIG $$$$$$" Waddaya think? :)

You're absolutely right about how picking the implementation limits the
possible solutions. In this case, however, there is an even bigger picture.
This is one of many pieces--all web based. The page that displays mail
links will have other necessary stuff on it as well. I have tried to
convince upper mgt that maybe a thin client is not the right solution for
this project and a GUI might be better. Not just because of the mail but
other challenges we're facing. That idea flew like the Hindenburg. "It's
gotta be HTML!"

John
 
Yeah, but Outlook would have to be installed on the server in order to do
what he wants I think and that's not recommended. Also Outlook won't read
eml files.

steve
 
Stingray said:
Steve,
Yes, I could do that. But then I'd have to train users to do this. There
will still be those who click the link and report a bug that the link
doesn't work. You know how users are. As I always say, if it weren't for
users, the software would work perfectly!


Yep, the users mess it up all the time. None of my programs would crash if
it weren't for the users. <VBG>

steve
 
Guys - I'm having a problem that this thread (appears) to solve on the
side... any help or insight would be GREATLY appreciated.

I also spoke with Chilkat and we both could not come up with a good
solution...

I'm trying to email an MHT containing a web page and a single embedded
image.
The MHT needs to be an >attachment< so that when double clicked, it likely
opens IE for viewing (as we have an IE plugin).

However, when you email from Outlook or Outlook Express (2002) to Eudora,
the attached MHT gets an extra rfc822 header slapped onto it and Eudora
reads it as embedded, not attached. Additionally, although irrelevant, the
image doesn't show up in the embedded browser or when 'Viewed in Browser.'
So, Outlook and Outlook Express appear to break it by adding the rfc822
(Content-Type) line...

However (again), from Eudora to Eudora, this works. From Outlook to Outlook
or Outlook to Outlook Express or Outlook Express to Outlook, or EVEN from
Eudora to Outlook or Outlook Express it works just fine.
Summary:
(good) Eudora -> OutlookExpress
(good) Eudora -> Outlook
(good) Eudora -> Eudora
(good) Outlook -> Outlook
(good) Outlook Express -> Outlook
(good) Outlook -> Outlook Express
(good) Outlook Express -> Outlook Express
(BAD) Outlook Express -> Eudora
(BAD) Outlook -> Eudora

If >anyone< has any insight into how to make a single file sent thru email
open with Internet Explorer and display an image... I'd appreciate reading
it.

I've attached my sample MHT text for study.
Thanks in advance,
-James Gale

(beginning of MHT file below this line) ***********
From: <Saved by Microsoft Internet Explorer 5>
Subject: Testing
Date: Thu, 13 Nov 2003 23:08:42 -0800
MIME-Version: 1.0
Content-Type: multipart/related;
boundary="----=_NextPart_000_0000_01C3AA3B.149690B0";
type="text/html"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C3AA3B.149690B0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: file://C:\projects\test\test.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Testing BASE Item 1</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR></HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV align=3Dcenter><IMG =
src=3D"file:///C:/projects/test/sample.jpg">=20
<BR><BR>This is a test<BR><BR></DIV></BODY></HTML>

------=_NextPart_000_0000_01C3AA3B.149690B0
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-Location: file:///C:/projects/test/sample.jpg

/9j/4AAQSkZJRgABAQEASABIAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkz
ODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2Nj
Y2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAAUABQDAREA
AhEBAxEB/8QAFgAAAwAAAAAAAAAAAAAAAAAABQYH/8QAKRAAAQMCBAUEAwAAAAAAAAAAAQIDBBEh
AAUGEgcTMUFxFFFhkSIj8P/EABgBAAMBAQAAAAAAAAAAAAAAAAABAgME/8QAHREAAgICAwEAAAAA
AAAAAAAAAAECEQMhEiIxQf/aAAwDAQACEQMRAD8AoGAATqLPWMhy/wBQ4EuOqIDTO7aXLivY9Bev
gd8VGPJgSZMTM81celtxJMkuOEuONMlQKjc9BQdenzjotLRI4ZDrp5qQqJqEbNtRzg2QpKgTULSP
qwtS/uM5Y/sR2Bo7U/W2ouY6FchB/NQoOS1uJCa0ubkC1T4BpWoIPSpRIrEKK3GitJaZbFEoT2/v
fGDdjEjiPlEJmGzmLLKWpC3uWsoAAXUKVUjuajr83ramuOTuhMLcPobMfTTchCf2yVqU4ogVsopA
8W+ycTkfYEM+Mxn/2Q==

------=_NextPart_000_0000_01C3AA3B.149690B0--

(end of included MHT file above this line) **********
 
The only thing I can suggest is you zip it and then attach it. They would
have to unzip it, but it would be correct then.

steve
 
Back
Top