Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identify the default email client
Message
From
23/09/2005 17:46:51
 
 
To
22/09/2005 09:34:01
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01051778
Message ID:
01052588
Views:
15
Hi Tracy -

Thanks for the tip. I had actually looked at similar code a long while back and given up on it due to problems with the encoding of special characters. However that was a different project and my current one shouldn't have that problem. It seems to be working OK at the moment.

Thanks again


>The below code works for us using multiple email client types so far without problem. I got most of the code from Rick Strahl's website examples. Does it fail for any of your email clients?
>
>*:*****************************************************************************
>*:
>*: Procedure file: SENDEMAIL.PRG
>*:
>*:*****************************************************************************
>* Calls the user's default email client and passes the recipient's email address,
>*   email subject, and email textbody.
>* The email client is launched but the user must manually click on SEND.
>* Based on whitepapers from http://www.west-wind.com/articles.asp
>******************************************************************************
>* Example Use:
>* sendemail('myemail@mymailserver.com','Subject Line','Text body of message')
>******************************************************************************
>*
>LPARAMETERS tcRecipient,tcSubject,tcBody
>
>RETURN GoSite("mailto:" + tcRecipient + ;
>             "&Subject=" +STRTRAN(UrlEncode(tcSubject),"+"," ") +;
>             "&Body=" + STRTRAN(UrlEncode(tcBody),"+"," "))
>
>
>*----------------------------------------------------------------
>FUNCTION GoSite(tcUrl, tcAction, tcDirectory, tcParms)
>
>IF EMPTY(tcUrl)
>   RETURN -1
>ENDIF
>
>IF EMPTY(tcAction)
>   tcAction = "OPEN"
>ENDIF
>
>IF EMPTY(tcDirectory)
>   tcDirectory = SYS(2023)
>ENDIF
>
>IF EMPTY(tcParms)
>   tcParms = ""
>ENDIF
>
>DECLARE INTEGER ShellExecute ;
>    IN SHELL32.dll ;
>    INTEGER nWinHandle,;
>    STRING cOperation,;
>    STRING cFileName,;
>    STRING cParameters,;
>    STRING cDirectory,;
>    INTEGER nShowWindow
>
>DECLARE INTEGER FindWindow ;
>   IN WIN32API STRING cNull,STRING cWinName
>
>RETURN ShellExecute(FindWindow(0,_SCREEN.caption),;
>                    tcAction,tcUrl,;
>                    tcParms, tcDirectory,1)
>
>*------------------------------------------------------------------
>Function UrlEncode( tcValue, llNoPlus )
>
>LOCAL lcResult, lcChar, lnSize, lnX
>lcResult=""
>
>FOR lnX=1 to len(tcValue)
>   lcChar = SUBSTR(tcValue,lnX,1)
>   IF ATC(lcChar,"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") > 0
>      lcResult=lcResult + lcChar
>      LOOP
>   ENDIF
>
>   IF lcChar=" " AND !llNoPlus
>      lcResult = lcResult + "+"
>      LOOP
>   ENDIF
>
>   *** Convert others to Hex equivalents
>   lcResult = lcResult + "%" + RIGHT(transform(ASC(lcChar),"@0"),2)
>ENDFOR
>RETURN lcResult
>
>
>>I have a button in my application that drafts an email message to the person in the table. The code is this:
>>
>>oOutlook=CREATEOBJECT("Outlook.Application")
>>oNewMail=oOutlook.CreateItem(0) 		&& 0 = olMailItem
>>oNewMail.Recipients.Add(E_mail)
>>oNewMail.Subject=""
>>oNewMail.Body=""
>>oNewMail.display
>>
>>
>>This works fine if the user has outlook installed as their email client. However my users use a variety of email clients including Eudora and others. Is there a way to programmatically identify the default email client and start it up with code equivalent to the above?
>>
>>Thanks for any help.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform