Posted By: ben2004uk | Mar 9th, 2007 @ 4:01 PM
page 1 of 1
Comments: 7 | Views: 14336

Hello,

Got a problem at the moment and I just can't see a solution.

Requirements:
C# application requires emailing a known file to a person.
Email must be sent via default mail client (outlook, windows mail, thunderbird)
Email must have attachment programmically attached.
Application is a desktop client developed in C# 2.0
Can be either sent directly from application, or just load email to be sent from client.

I have tried various things, for example using "mailto:", but this doesn't allow the attachment to be added.

I know on the Web we can use the System.Web.Mail (or is it net?) and send it via a known SMTP server, but on the client we don't know what the server is for the user and I don't really want them going via my server...

Any advice or help on this would be great!!

Thanks

Ben

I don't think there is a solution to this. You're probably going to be stuck with sending the message using the .NET classes.
The artical on how to do this in  C# via with COM is @

http://support.microsoft.com/kb/310263
CannotResolveSymbol
CannotResolveSymbol
{insert caption here}
ben2004uk wrote:
I know the New York Times reader does it....only tried it when it with outlook 2003 as the default.

MSDN has something about using Outlook COM interop to create and send email which I need to do a POC with, but wondering what happens if outlook isn't installed, i still want users to be able to send email - VM time I think.....

Thanks tho


Obviously you won't be able to use Outlook COM interop if Outlook is not installed.

I don't think you're going to find a way that works across all mail clients.  You could have the user select which mail client they use, but you'll still be limited to certain clients that have libraries you can use.
odujosh
odujosh
Need Microsoft SUX now!

By not doing an auto send you can not garentee the user will send the message for you. Essentially you are hopping for a security hole. If any process could automagically send messages from x mail app wouldn't that be a problem any hacker could love?

My suggestion is you go to the trouble of setting up infrastructure if you need it.

Matthew van Eerde
Matthew van Eerde
AKA Maurits

If you can guarantee Outlook there's a way to do this.  If you can guarantee a MAPI profile is set up there's a way to do this.  If you are willing to have the C# app be an SMTP client there's a way to do this.  If you're willing to subject yourself to the limitations of mailto: there's a way to do this.

But, alas, I don't think there's a way to automate mail clients in general.  I suppose you could develop independent automation for the five or six most popular mail clients and keep a list of "supported mail clients".

This might be of interest: http://www.codeproject.com/cs/internet/SendFileToNET.asp

page 1 of 1
Comments: 7 | Views: 14336
Microsoft Communities