Tuesday, January 19, 2016

Enable SSL in Emails

Recently, the requirement was to enable SSL for emails. There is a hidden but easy parameter that controls it.

Navigate to Classes->SysEmailDistributor->processEmails

and add the following code


CodeAccessPermission::revertAssert();

                    mailer.smtpRelayServer(relayServer,portNumber,userName,password,ntlm);
mailer.enableSsl(parameters.EnableSSL); // locus90 edit 09/11/2015
i.e.




You should also add code to catch any new exception because of this in the catch block.

 e = ClrInterop::getLastException();//where e is of the type System.exception
                    while (e)
                    {
                        info(e.get_Message());
                        e = e.get_InnerException();
                    }
i.e.





That should enable SSL.

Bonus: To add an attachment to an email, follow this link https://blogs.msdn.microsoft.com/czdaxsup/2008/12/03/howto-sending-mail-from-ax-using-net-framework/

No comments:

Post a Comment