Are there any more effective alternatives to mailto?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The mailto: command is very useful when only basic parameters need to be
sent, such as the To field, but not so useful when a large chunk of HTML
formatted body text must also be sent. I basically want my app to to create a
full new mail message (in the default mail client, usually Outlook), which
the user can then modify and send. Specifying
"mailto:[email protected]?body=XXX" will not suffice, as the body text is
too long and must be HTML formatted.
 
hi,
The mailto: command is very useful when only basic parameters need to be
sent, such as the To field, but not so useful when a large chunk of HTML
formatted body text must also be sent. I basically want my app to to create a
full new mail message (in the default mail client, usually Outlook), which
the user can then modify and send. Specifying
"mailto:[email protected]?body=XXX" will not suffice, as the body text is
too long and must be HTML formatted.

you could create an .eml file and open that.

crea
 
Hi James,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to create an HTML format email
message in your app. If there is any misunderstanding, please feel free to
let me know.

As far as I know, we can use classes under System.Web.Mail namespace to
achieve this. Creating a MailMessage object will create a mail message. We
can also use MailAttachment class to add attachments to particular message.

The following link provides an example:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemwebmailmailmessageclasstopic.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thanks for the advice. It is true that I am aiming to create an
HTML-formatted email, but the System.Web.Mail namespace is not suitable.
Outlook is a very powerful and effective tool, and having generated the
email, I would like the user to be able to edit it using Outlook before
sending. Also I can't make the SmtpMail.SendMessage(MailMessage message)
method work - although this doesn't really matter, as it's not what I want.
Would the creation of an .eml file - as Crea-Ue. Kirdar suggested - be
possible, and if so, how is this most easily done? Is there an alternative?
 
Hi James,

Yes, we can create a .eml file. However, the system will choose the default
application to open the .eml file, sometimes Outlook Express. So if you
need to use Outlook to generate an email message, you can try to use
Outlook automation. Here are some good examples:

http://www.experts-exchange.com/Databases/MS_Access/Q_21081307.html
http://forums.aspfree.com/t23284/s.html
http://www.serverwatch.com/tutorials/article.php/1474711

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thanks for the suggestions, but Outlook automation is not really what I'm
looking for. My previous post was unclear - I don't actually mind whether the
user's default mail program is Outlook, Outlook Express or any other app. As
I understand, creating a .eml file and opening it in the default mail program
with System.Diagnostics.Process.Start("C:\email.eml") would be ideal. I
cannot, however, find any samples or tutorials to achieve this. Can you
please provide some links for creating .eml files with C# (not the Expert's
Exchange, as I don't have a subscription)? I would ideally prefer not to
involve any 3rd party or COM components.

Many thanks in advance,

James.
 
Hi James,

If you need to create an .eml file, you can just use File.Create method to
create a blank file with the extension .eml. Then use
System.Diagnostics.Process.Start("C:\email.eml") to start it. But this is
only a received message and you cannot modify it.

It seems that we cannot parse a .eml file without using MAPI.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi James,

Yes, Outlook automation doesn't work on those computers that don't have
Outlook installed. Currently I can't find any sample which use code to
create a .eml file. An email message is always a simple ASCII text file. An
.EML file is a Microsoft extension used to denote an email file; thus
myemail.eml is an ASCII text file as received by your email client. The
file is still a simple ASCII text file that can be read by Notepad or any
other text editor. You can modify the content directly like the following.

Subject:
Date: Wed, 1 Sep 2004 16:08:24 +0800
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0006_01C4903D.F386A970"
X-Priority: 3
X-MSMail-Priority: Normal
X-Unsent: 1
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180

This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C4903D.F386A970
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable


------=_NextPart_000_0006_01C4903D.F386A970
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0006_01C4903D.F386A970--

I will try to find if there is any other APIs that can do. But seems to be
hopeless.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thank you very much for your help. I'll test it all over the next couple of
days and post back if I have any problems/success.
 
Back
Top