Calling a user's email client on windows
-
I want my application to interface to the user's email client application. I've currently got this working using MAPI, but, of course, not all email clients use MAPI. On my computer it calls MS Outlook, but my real email application is Netscape. I've tried PJ Naughters' SMTP class but you have to know what the user's SMTP service is called (e.g. smtp.ozemail.com.au, or whatever) and this actually bypasses their email application. I've also tried his CMC class, but CMC seems to be an ancient concept that has not continued existence. My requirement is simply to call the user's email application, supplying the "to" address and an attachment. Does anyone have any idea how to do this on Windows? (It's trivial on UNIX). Russell Robinson (russellr@rootsoftware.com) Author of TTMaker (Advanced Timetabling Software) http://www.rootsoftware.com
-
I want my application to interface to the user's email client application. I've currently got this working using MAPI, but, of course, not all email clients use MAPI. On my computer it calls MS Outlook, but my real email application is Netscape. I've tried PJ Naughters' SMTP class but you have to know what the user's SMTP service is called (e.g. smtp.ozemail.com.au, or whatever) and this actually bypasses their email application. I've also tried his CMC class, but CMC seems to be an ancient concept that has not continued existence. My requirement is simply to call the user's email application, supplying the "to" address and an attachment. Does anyone have any idea how to do this on Windows? (It's trivial on UNIX). Russell Robinson (russellr@rootsoftware.com) Author of TTMaker (Advanced Timetabling Software) http://www.rootsoftware.com
To get you started, you can call ShellExecute() on "mailto:person@whatever.com?Subject=Subject here" to open the mail client with a new message. --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.
-
To get you started, you can call ShellExecute() on "mailto:person@whatever.com?Subject=Subject here" to open the mail client with a new message. --Mike-- http://home.inreach.com/mdunn/ The preferred snack of 4 out of 5 Lounge readers.
Thanks for the suggestion Mike, but there's no way to attach a file with this "mailto" mechanism. Russell Robinson (russellr@rootsoftware.com) Author of TTMaker (Advanced Timetabling Software) http://www.rootsoftware.com
-
Thanks for the suggestion Mike, but there's no way to attach a file with this "mailto" mechanism. Russell Robinson (russellr@rootsoftware.com) Author of TTMaker (Advanced Timetabling Software) http://www.rootsoftware.com
Yep, sure is. Just use mailto:address@domain.com?attach="your attachment.ext" Hope that helps, Andrew.
-
Yep, sure is. Just use mailto:address@domain.com?attach="your attachment.ext" Hope that helps, Andrew.
Is there any way of specifying the attachment *and* a subject? Thanks for this excellent tip.
-
Is there any way of specifying the attachment *and* a subject? Thanks for this excellent tip.
I tried this using outlook and it worked for setting both subject and attachment. CString strTemp = _T("C:\\test.txt"); strTemp.Format (_T("mailto:xxx@yyy.com?Subject=My subject\"%s\""),strFilePath); ShellExecute (NULL, //Parent window _T("open"), //verb strTemp, NULL,//File NULL,//Parameters SW_SHOW);
-
Yep, sure is. Just use mailto:address@domain.com?attach="your attachment.ext" Hope that helps, Andrew.
Hi Andrew, With Outlook Express 5 I can't get ?attach to do anything - it seems to be ignored. ?subject works fine though. Do you (or anyone) have any suggestion? I remember trying this a couple of years ago and getting nowhere. It is much better than using MAPI, but I have to be able to specify the attachment. Cheers, Simon :confused:
-
Yep, sure is. Just use mailto:address@domain.com?attach="your attachment.ext" Hope that helps, Andrew.
Hi Andrew, Thanks for the response, and I'm sorry that I haven't replied sooner.....been busy fighting other fires. Unfortunately, the attach parameter doesn't seem to work at all. I've tried with Outlook Express 5 and Netscape Communicator as email clients. It doesn't work with either. I can get subject and body parameters to work, but the attach is just ignored. Also, I haven't found any information anywhere on the net that documents this facility. RFCs 1738 and 2368 don't mention "attach", though RFC 2368 allows for the possibility of it. So, it looks like I'm going to have to "do it myself" somehow. (We are in the 21st century aren't we??????) Russell Robinson (russellr@rootsoftware.com) Author of TTMaker (Advanced Timetabling Software) http://www.rootsoftware.com