Friday, 8 February 2019

SEND EMAIL IN D365 CODE X++ LOGIC

SEND EMAIL IN D365 CODE X++ LOGIC

public static void SendEmail()
{
System.IO.Stream workbookStream = new System.IO.MemoryStream();
SysMailerSMTP   mailer = new SysMailerSMTP();
SysMailerMessageBuilder builder = new SysMailerMessageBuilder();
SysEmailParameters parameters = SysEmailParameters::find();
;
 //you will have to setup the below parameters in sysadmin module
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.SMTPUseNTLM);
}
else
{
warning(“SERVER NOT FOUND”);
}


builder.setFrom(SysEmailParameters::find().SMTPUserName);
builder.addTo(“To address”);
builder.addCc(“CC address”);
builder.addAttachmentFromFile(“Fetch the file from the path”);
builder.setSubject(“Email subjectl”);
SysMailerFactory::getNonInteractiveMailer().sendNonInteractive(builder.getMessage());

}

No comments:

Post a Comment

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...