24 Mart 2016 Perşembe

AXAPTA - Solve of turkish letter problem when send mail with sysmailer class

I found this solution from a blog which I cannot remember. Turkish letters (or another special letters with some languages) will not shown when send mail with sysMailer class if you won't add this red line:


   SysEmailParameters  parameters;
    SysMailer           mailer;
    ;
    new InteropPermission(InteropKind::ComInterop).assert();
        parameters = SysEmailParameters::find();

        mailer = new SysMailer();
        if (parameters.SMTPRelayServerName)
        {
            mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
                               parameters.SMTPPortNumber,
                               parameters.SMTPUserName,
                               SysEmailParameters::password(),
                               parameters.NTLM);
        }
        else
        {
            mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
                               parameters.SMTPPortNumber,
                               parameters.SMTPUserName,
                               SysEmailParameters::password(),
                               parameters.NTLM);
        }
        mailer.fromAddress(fromAddr);
        mailer.tos().appendAddress(toAddr);
        mailer.subject(subject);
        //solution for turkish letter problem (ÖöÇçĞğÜüŞşİı):
        mailer.bodyCharSet("Windows-1254");
        if(FileName)
            mailer.attachments().add(FileName);
        mailer.ccs().appendAddress(ccAddr);
        mailer.bccs().appendAddress(bccAddr);
        mailer.htmlBody(body);
        mailer.sendMail();
    }
    CodeAccessPermission::revertAssert();

Hiç yorum yok:

Yorum Gönder