Send E-mail using SysEmailTable::sendEmail() method

 * Send simple paragrapgh or message using Email Template

 * SysEmailTable is a table and sendMail() is a method



static void ProjectAssignmentEmailUsingSysEmailTable(Args _args)

{

    SysEmailId sysEmailId;


    Map mappings;

    str recepient;

    HcmWorker worker;

    ProjTable projTable;


    worker = HcmWorker::find(5637183005);

    projTable = projTable::find('6805');


    sysEmailId = 'Custom';


    if (worker && projTable)

    {

            recepient = worker.email();


            mappings = new Map(Types::String,Types::String);


            mappings.insert('WorkerName', worker.name()); // this will replace variable with actual value.

            mappings.insert('ProjectId', projTable.ProjId);

            mappings.insert('ProjectName', projTable.Name);


            SysEmailTable::sendMail(sysEmailId,

                            SysEmailTable::find(sysEmailId).DefaultLanguage,

                            'emplyee@outlook.com',

                            mappings,

                            '',

                            '',

                            true,

                            curUserId(),

                            true);

    }

    info('Email will be in waiting in System administration --> E-mail processing --> E-mail sending status');

}

Comments

Popular posts from this blog

Assembly reference containing type is not referenced, Object 'CLRObject' could not be created

Data cleanup in x++

Send E-mail using SysMailer class