Thursday, 11 March 2010

AX - send e-mail job

Sometimes you want to test your SMTP setup. I normally run this job (don't forget to change the parameters):

static void sendMail(Args _args)
{
    SysMailer           sysMailer;
    SysEmailParameters  sysEmailParameters;
    ;
    sysEmailParameters = SysEmailParameters::find();

    sysMailer = new SysMailer();
    sysMailer.SMTPRelayServer(sysEmailParameters.SMTPRelayServerName, sysEmailParameters.SMTPPortNumber, sysEmailParameters.SMTPUserName, sysEmailParameters::password());

    sysMailer.fromAddress("from@defaultemail.com.au");
    sysMailer.tos().appendAddress("to@defaultemail.com.au");
    sysMailer.subject("test - subject");
    sysMailer.htmlBody("test - body");
    sysMailer.sendMail();
}

No comments: