API Call to find the installed Default Email Client ??
-
I would like users of my program to be able to launch their currently installed email client from within my program. I would know the proper API call to find the path to the executable for the Email client that is currently installed on a machine. C/C++, Visual Studio 6.0 Many thanks, :) Robert
-
I would like users of my program to be able to launch their currently installed email client from within my program. I would know the proper API call to find the path to the executable for the Email client that is currently installed on a machine. C/C++, Visual Studio 6.0 Many thanks, :) Robert
Admitedly a cheesy solution, but it should get the job done. :)
HINSTANCE hInst = ::ShellExecute
(NULL, "open",
"mailto:ravib@ravib.com",// use "mailto:" to open mail
"", "", SW_SHOW);// client w/o opening a new msg
ASSERT (hInst > 32);/ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
-
Admitedly a cheesy solution, but it should get the job done. :)
HINSTANCE hInst = ::ShellExecute
(NULL, "open",
"mailto:ravib@ravib.com",// use "mailto:" to open mail
"", "", SW_SHOW);// client w/o opening a new msg
ASSERT (hInst > 32);/ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
Ravi, Thanks for reply. I have used that approach fro text messages. The purpose of this feature is to allow the User of my program to attach a file to an email. I believe that only very small files can be attached with ShellExecute(). MAPI is another way to do it but MAPI is a real mess of DLLs and various users may not have the right version of the MS MAPI DLL on their machine. Also, some email clients like Eudora require the user to specifically turn on MAPI, so using MAPI complicates their lives. If I can find the default email client then I can launch it with the attached file as a command line parameter. Thanks, Robert
-
Ravi, Thanks for reply. I have used that approach fro text messages. The purpose of this feature is to allow the User of my program to attach a file to an email. I believe that only very small files can be attached with ShellExecute(). MAPI is another way to do it but MAPI is a real mess of DLLs and various users may not have the right version of the MS MAPI DLL on their machine. Also, some email clients like Eudora require the user to specifically turn on MAPI, so using MAPI complicates their lives. If I can find the default email client then I can launch it with the attached file as a command line parameter. Thanks, Robert
Robert Palma Jr. wrote: I believe that only very small files can be attached with ShellExecute().
ShellExecute()
has no idea what you are using themailto:
protocol for. If there is a problem with the size of an attachment, it would be up to the mail client to deal with it. If the target machine already has a mail client configured, then MAPI is the way to go. See here for SMTP and MAPI articles.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
Robert Palma Jr. wrote: I believe that only very small files can be attached with ShellExecute().
ShellExecute()
has no idea what you are using themailto:
protocol for. If there is a problem with the size of an attachment, it would be up to the mail client to deal with it. If the target machine already has a mail client configured, then MAPI is the way to go. See here for SMTP and MAPI articles.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
Hi David, Thanks for reply. Lots of good articles on your link! Okay, how would you include an attachemnt in the mailto call?? ::ShellExecute(NULL, "open","mailto:joe@something.com","","",SW_SHOW); Thanks a lot, Robert
-
Hi David, Thanks for reply. Lots of good articles on your link! Okay, how would you include an attachemnt in the mailto call?? ::ShellExecute(NULL, "open","mailto:joe@something.com","","",SW_SHOW); Thanks a lot, Robert
Use this format: mailto:joe@something.com?subject=Test&attachment="c:\boot.ini"
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
Use this format: mailto:joe@something.com?subject=Test&attachment="c:\boot.ini"
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
Hi David, Here is what I tried: //Shell execute test //from David mailto:joe@something.com?subject=Test&attachment="c:\boot.ini" sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\misc\a.txt\""); ShellExecute(NULL,"open", buf,"","",SW_SHOWNORMAL); I tried this on NT and Win2K. I tried this on Eudora and Outlook 2003. In all cases, the email client loads the 'to' address and the 'subject', but does not seem to know about the attachment. I have been working on this since May. Back in May Jim Twine kindly told me (in this forum) that he did not think I could do this with ShellExecute and that I would have to use MAPI. I have not had success with MAPI so I have been looking at running the mail client from the command line. Outlook and Eudora seem to do this quite well. I just have to find out 'who' is the client and 'where' (directory) he is. Actually I REALLY don't even want to specify the 'to' address or the 'subject'. I'd like the User to pick the 'to' address from his email-client-addressbook. I would love to hear anymore thoughts on getting ShellExecute to work. It's seems quite simple and elegant and I use it all the time for other executables. All the best, :) Robert
-
Hi David, Here is what I tried: //Shell execute test //from David mailto:joe@something.com?subject=Test&attachment="c:\boot.ini" sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\misc\a.txt\""); ShellExecute(NULL,"open", buf,"","",SW_SHOWNORMAL); I tried this on NT and Win2K. I tried this on Eudora and Outlook 2003. In all cases, the email client loads the 'to' address and the 'subject', but does not seem to know about the attachment. I have been working on this since May. Back in May Jim Twine kindly told me (in this forum) that he did not think I could do this with ShellExecute and that I would have to use MAPI. I have not had success with MAPI so I have been looking at running the mail client from the command line. Outlook and Eudora seem to do this quite well. I just have to find out 'who' is the client and 'where' (directory) he is. Actually I REALLY don't even want to specify the 'to' address or the 'subject'. I'd like the User to pick the 'to' address from his email-client-addressbook. I would love to hear anymore thoughts on getting ShellExecute to work. It's seems quite simple and elegant and I use it all the time for other executables. All the best, :) Robert
Robert Palma Jr. wrote: sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\misc\a.txt\""); Should be:
sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\\misc\\a.txt\"");
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
Robert Palma Jr. wrote: sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\misc\a.txt\""); Should be:
sprintf(buf, "mailto:rpalma@mrtel.com?subject=test&attachment=\"c:\\misc\\a.txt\"");
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
Hi David, Thankyou for your very quick replys :) I fixed my dumb error in formating per your correction - thanks. Eudora still ignores the attachement. Outlook (this is different) says the command line switch is in error. I have had no luck with a command line reference from Eudora (Qualcomm) even though I am a re-registered user with the last 4 months. I will look for a reference on Outlook command line switches, but previous research efforts in this regard were not fruitful. Any other ideas? All the best, Robert
-
Hi David, Thankyou for your very quick replys :) I fixed my dumb error in formating per your correction - thanks. Eudora still ignores the attachement. Outlook (this is different) says the command line switch is in error. I have had no luck with a command line reference from Eudora (Qualcomm) even though I am a re-registered user with the last 4 months. I will look for a reference on Outlook command line switches, but previous research efforts in this regard were not fruitful. Any other ideas? All the best, Robert
Robert Palma Jr. wrote: Eudora still ignores the attachement. Admittingly, the attachment part may not be standard. You'll have to read the RFC for mailto: to find out. Robert Palma Jr. wrote: Outlook (this is different) says the command line switch is in error. I use Outlook 2000 and it worked for me. Robert Palma Jr. wrote: I will look for a reference on Outlook command line switches, but previous research efforts in this regard were not fruitful. Outlook's command line parameters, if it even has any, has nothing to do with the mailto: protocol. Check out the SMTP and MAPI links I provided earlier. Something else you might try is:
char szApp[MAX_PATH];
AssocQueryString(..., ".eml", "open", szApp, sizeof(szApp));
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown