Share |

Tuesday, May 30, 2006

Send email from Navision

For send email from Navision by means CAL, will use the following code:

Must be declare var objApp like Atomation assigning it to 'Microsoft Outlook 11.0 Object Library'.Application and the var objMail like Atomation assigning it to 'Microsoft Outlook 11.0 Object Library'.MailItem

//Create application
IF ISCLEAR(objApp) THEN CREATE(objApp);

//Create mail item
objMail := objApp.CreateItem(0);

//Set properties
objMail."To"('joseppages@hotmail.com');
objMail.Subject('Mail from Navision');
objMail.Body('This is a mail send from Navision.');

//Uncomment for display email
//objMail.Display();

//Send mail
objMail.Send();

Evidently that through objMail object we have other properties that we can use to our convenience, like CC or Importance.

3 comments:

HolmesMalone said...

I thought that using the outlook object would be a piece of cake after stumbling across your code. But I am having some real difficulties getting an email with a body that is more than 1024 characters long. I can't find an "addLine" type of function. Strange, right?

Scorpio said...

Hi,

It was good to know about the usuage of ''Microsoft Outlook 11.0 Object Library'.MailItem'. I was able to use it and create short emails with html text in body. (using the function ObjMail.HTMLBody().

But in case if i need to send a huge html page to the email body, i was not able to do it as the Text variables length is MAX 1024. Is their any way to appened the Html line to the existing Html Body.

Please do let me know if you have any answers/suggestions for this issue

Unknown said...

Is there any possibility to attach the file in mail item.

--sankar ganesh