Thursday, August 7, 2008

sending Emails using X++ Code in Axapta

ysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
mailer.fromAddress('moulikaku@hotmail.com');
mailer.fromName('minnu@gmail.com');
mailer.subject('What are you doing tonite???');
if (parameters.DNSServerName)
{
mailer.DNSServers().add(parameters.DNSServerName,
parameters.DNSTCPIPRetryCount,
parameters.DNSUDPRetryCount);
}

if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServers().add(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPServerIPAddress,
parameters.SMTPUserName,
parameters.SMTPPassword);

}
// Add your own code here, then send the message

======================================================

SysMailer mailer = new SysMailer();
mailer.body("My Body :)");
mailer.subject("WOW Baby");
mailer.fromAddress("minnu@anderson.com");
mailer.fromName("Peter Villadsen");
mailer.tos().add("moulikaku@gmail.com");
mailer.SMTPRelayServers().add("MyRelayServer");
mailer.sendMail();

======================================================
SysINetMail Mail=new SysINetMail() ;
Mail.sendMailAttach("minnu@gmail.com",
"mouli@gmail.com,
"WOW",
"My Body Text ;-)",
false,
"Attachment Path");


All the Best :-)
Publish Post
mouli

No comments: