首页 > 解决方案 > 我有发送电子邮件的 e-sql 代码。它工作正常,但 Base64 编码文件不会添加到电子邮件附件中,因此电子邮件没有它

问题描述

我有发送电子邮件的 e-sql 代码。它工作正常,但不幸的是 Base64 编码文件不加到电子邮件附件中,因此电子邮件没有它

CREATE COMPUTE MODULE Marketing_Mail_Distribution_Flow_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
   --       SET OutputRoot.Properties = InputProperties;
        SET OutputRoot.Properties.CodedCharSetId = '1208';
        SET OutputRoot.Properties.Encoding = '546';

    SET OutputRoot.EmailOutputHeader.From =InputRoot.XMLNSC.Email.From;
    SET OutputRoot.EmailOutputHeader.To = InputRoot.XMLNSC.Email.To;
    SET OutputRoot.EmailOutputHeader.Subject = InputRoot.XMLNSC.Email.Subject;
    SET OutputRoot.BLOB.BLOB = CAST(InputRoot.XMLNSC.Email.Text AS BLOB CCSID 1208 );
    SET OutputLocalEnvironment.Destination.Email.BodyContentType = 'text/html; charset=utf-8';


    --Tried both of these pieces of code to set Attachment to base64 attachment which is sent via SOAP 
    --SET OutputLocalEnvironment.Destination.Email.Attachment.Content = InputRoot.XMLNSC.Email.Attachment;
    SET OutputLocalEnvironment.Destination.Email.Attachment.Content = CAST(BASE64DECODE(InputRoot.XMLNSC.Email.Attachment) AS BLOB CCSID 1208);     

    SET OutputLocalEnvironment.Destination.Email.Attachment.ContentType = 'multipart/related;boundary=myBoundary';
    SET OutputLocalEnvironment.Destination.Email.Attachment.ContentName = InputRoot.XMLNSC.Email.AttachmentName;
    SET OutputLocalEnvironment.Destination.Email.Attachment.ContentEncoding = 'base64';

END;
END MODULE;

标签: smtpbase64ibm-integration-bus

解决方案


推荐阅读