471,319 Members | 2,675 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

.NET equivalent of html 'mailto ?

I have a small light-weight winform app (C# .NET 2.0) that does some
web-scraping and, under certain conditions, needs to send a plain-text
e-mail.

This is simple for mail servers that don't require authentication, but my
own mail server (GoDaddy) does, and I want it to work with such servers.

What I want is for the application to invoke the default mail handler on the
user's machine exactly as using the 'mailto facility in HTML will.

And I don't want to have to build in username/password entry fields that
will add a real security burden.

I've looked at all the smtpmail and mailmessage code on CodeProject, hunted
through the MS newsgroups, and I am assuming right now this cannot be done
for security reasons.

But I wonder if some kind of "hack" like putting a WebBrowser control in and
trying to use 'mailto on a composed link in its hidden HTML might work.

Outlook automation would be another avenue of approach, but I'd like to stay
away from being locked into that application being present.

Appreciate any suggestions !

Bill
Feb 20 '06 #1
3 13193
I should have noted that the solution I am looking for is not exactly like
invoking 'mailto from HTML.

You can, indeed, easily invoke 'mailto on a linklabel in .NET by using

// mailToURL : string in typical mailto HTML format
System.Diagnostics.Process.Start(mailToURL);

And this will fire up your default mail client with a structured message.

But it won't send the message which means unattended use is out.

I need something that will send the message from the default e-mail client,
as well as invoking it.

thanks, Bill

Feb 20 '06 #2
Bill,
unfortunately, this is not as easy as it may seem, since some machines may
have Outlook, and others only Outlook Express, which does not expose a
programmable COM interface.
Your best bet is to use the System.Net.Mail namespace.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Bill Woodruff" wrote:
I have a small light-weight winform app (C# .NET 2.0) that does some
web-scraping and, under certain conditions, needs to send a plain-text
e-mail.

This is simple for mail servers that don't require authentication, but my
own mail server (GoDaddy) does, and I want it to work with such servers.

What I want is for the application to invoke the default mail handler on the
user's machine exactly as using the 'mailto facility in HTML will.

And I don't want to have to build in username/password entry fields that
will add a real security burden.

I've looked at all the smtpmail and mailmessage code on CodeProject, hunted
through the MS newsgroups, and I am assuming right now this cannot be done
for security reasons.

But I wonder if some kind of "hack" like putting a WebBrowser control in and
trying to use 'mailto on a composed link in its hidden HTML might work.

Outlook automation would be another avenue of approach, but I'd like to stay
away from being locked into that application being present.

Appreciate any suggestions !

Bill

Feb 20 '06 #3
You can always use launch the default mail client via the registry -
the MAPI setting is stored in the registry:

HKCU\SOFTWARE\Clients\Mail\

Holds all the mail clients

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\shell\o pen\command

holds the default client in the (Default) key

Feb 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Ann | last post: by
3 posts views Thread by Grumble | last post: by
2 posts views Thread by Joe W Larson | last post: by
3 posts views Thread by rvanvolken | last post: by
2 posts views Thread by =?Utf-8?B?Q2FwdGFpbiBEYXZlIQ==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.