Monday, April 20, 2026

Stop sending notifications from dynamics through SMTP when you have subject #FAIL#

Scenario :- I got a requirement where dynamics sends notification and these notifications are to be restricted so these the logic where you can control the notifications.

Code:-

ExtensionOf(classstr(SysMailerSMTP))]
 final class NotificationsstopSysMailerSMTP_Extension
{

    protected boolean sendMessage(System.Net.Mail.MailMessage _message, boolean _interactive, guid _correlationId)
    {
        str val="#FAIL#";
        if(strKeep(val,_message.Subject)==val)
        {
            System.Net.Mail.MailAddress buf;
            System.Net.Mail.MailAddressCollection buf2;
            System.Net.Mail.MailMessage _messageloc;
            _message=_messageloc;
            _message.Subject='';
            _message.Sender=buf;
        }
        boolean ret;
       
        ret =  next sendMessage( _message,  _interactive,  _correlationId);
        return ret;
       
    }

}

NOTE:- This is a framework class customizations .So make sure we go with procedure  until and unless you are confident to implement the change

Thank you !! 

No comments:

Post a Comment

Stop sending notifications from dynamics through SMTP when you have subject #FAIL#

Scenario :- I got a requirement where dynamics sends notification and these notifications are to be restricted so these the logic where you ...