Error with SMTP

aboomaraboomar Member Posts: 47
edited 2009-02-23 in Navision Attain
please guys i need help i am try to send mail with smtp but i have error message ( unknown class returned........)
I think the error in 'Microsoft CDO For Exchange 2000 ibrary'
because i wok on XP


// objEmailConf -- 'Microsoft CDO For Exchange 2000 ibrary'.Configuration
// objEmail -- 'Microsoft CDO For Exchange 2000 Library'.Message
// flds -- 'Microsoft ActiveX Data Objects 2.5 Library'.Fields
// fld -- 'Microsoft ActiveXData Objects 2.5 Library'.Field


IF ISCLEAR(objEmailConf) THEN
CREATE(objEmailConf);
flds := objEmailConf.Fields;
fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver');
fld.Value('MAIL.domain.com');
fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserverport');
fld.Value(25);
fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/sendusing');
fld.Value(2);
flds.Update();


IF ISCLEAR(objEmail) THEN CREATE(objEmail);
objEmail.Configuration :=objEmailConf;
objEmail.From := 'mailfrom@hotmail.com';
objEmail."To" := 'mailto@hotmail.com';
objEmail.Subject := 'Subject';
MBody:='SMTP';
IF MBody <> '' THEN
objEmail.TextBody := MBody;
objEmail.Send; 8-[ 8-[

Comments

  • JPHSCJPHSC Member Posts: 67
    Take a look at codeunit 400, here you can sent mail without the need of all those automation objects ..

    cdu400.CreateMessage(SenderName,SenderAddress,Recipients,Subject,Body,HtmlFormatted);
    cdu400.Send();

    And you need to set your settings at :
    Administration - IT administration - General Setup - SMTP Mail Setup

    This works great, and it's all in NAV.
Sign In or Register to comment.