Hi everyone,
Just I want to share a code that I’m using to send emails from Outlook using Xojo. I have “adapted” the code to work with OLEObject. Just keep in mind that the local machine must have installed Outlook application with an account configured and Outlook must be open.
I have created a small app with Xojo/RS and I have tested the code with Windows 7 and 8 using Outlook 2007 version. I have not had any problems. I hope it’s useful for who need it. The code is :
=====================>
dim objApp as OLEObject
dim objMail as OLEObject
dim sFile as String
sFile=“yourpathfile\yourpicture.jpg”
objApp=new OLEObject(“Outlook.Application”)
objMail=OutApp.CreateItem(0)
objMail.Value(“To”)=“someone@gmail.com”
objMail.Value(“Subject”)=“Hello Xojo”
objMail.Value(“Body”)=“Hi Xojo Community”
objMail.Attachments.Add sFile
objMail.Send
MsgBox “Done ! Great !”
//error handler
Exception err
if err IsA RuntimeException then
MsgBox “The error message”
end if