jueves, enero 14, 2010

Como enviar un email con un informe adjunto a través de Dynamics NAV

Previamente ha de configurarse el SMTP, mediante el Form 409.

//Create messagecu400.CreateMessage('Sender','sender@mycompany.com',
'recipient1@yourcompany.com;recipient2@yourcompany.com',
'Subject','Body <b>in HTML</b> format.<BR>Regards.',TRUE);
//Generate the report in html formatrpt101.SAVEASHTML(TEMPORARYPATH + 'report101.html');
//Attach file in to email
cu400.AddAttachment(TEMPORARYPATH + 'report101.html');
//Send email
cu400.Send;
//Erase fileERASE(TEMPORARYPATH + 'report101.html');