Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending email through Outlook
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01532147
Message ID:
01532152
Views:
59
>>I need to send email through Outlook
>>
>>I have been testing the following code and have found that it has problems when the body string gets large or unwanted character get in the body string
>>
>>Can anyone point me to a more reliable way of Outlook sending
>>
>>
>>DECLARE INTEGER ShellExecute IN shell32.dll ;
>> INTEGER hndWin, STRING cAction, STRING cFileName, ;
>> STRING cParams, STRING cDir, INTEGER nShowWin
>>
>>lcMail = "mailto:colin@colin-northway.com"+ ;
>> "?CC= colin@colin-info.com,"+ ;
>> "&Subject= Meet for lunch"+ ;
>> "&Body=Please join me for sandwich. We can meet at noon."
>>ShellExecute(0,"open",lcMail,"","",1)
>
>Colin,
>
>Try this, it's a quattro stagioni
>
>(1) Prepare a CDO message
>(2) Save the stream of the CDO message to a temp eml file
>(3) Launch ShellExecute - it will open the default mail (outlook, windows live mail, ...)
>
>(4) get rid of the temp eml file
>
>local objMsg, msgStream, tmpFilename
>
>&& (1) Prepare a CDO message
>
>
>objMsg                 = CreateObject('CDO.Message')
>objMsg.To            = 'colin@colin-northway.com'
>objMsg.subject    ='Meet for lunch'
>
>
>if( .t. ) && not a html file
>    objMsg.TextBody        ='Please join me for sandwich. We can meet at noon'
>else
>    objMsg.HTMLbody = FileToStr('d:\tmp\pp.htm')
>endif
>
>&& add attachment if needed
>
>=m.objMsg.AddAttachment('d:\tmp\1.pdf')
>
>objMsg.Fields("urn:schemas:mailheader:x-unsent")=1
>=m.objMsg.Fields.Update()
>
>&& (2) Save the stream of the CDO message to a temp eml file
>
>msgStream = m.objMsg.GetStream()
>
>tmpFilename = 'd:\tmp\1.eml'
>=m.msgStream.SaveToFile(m.tmpFilename )
>
>&& (3) Launch ShellExecute - it will open the default mail (outlook, windows live mail, ...)
>
>
>DECLARE INTEGER ShellExecute IN shell32.dll ;
>     INTEGER hndWin, STRING cAction, STRING cFileName, ;
>    STRING cParams, STRING cDir, INTEGER nShowWin
>
>=ShellExecute(0,"open",m.tmpFilename ,"","",1)
>
>&& (4) get rid of the temp eml file
>
>&& left for you
>
>
>
Thanks - I'll try that
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Reply
Map
View

Click here to load this message in the networking platform