<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article How to handle special characters in the Subject field using Qlik Application Automation Mail Connector in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-handle-special-characters-in-the-Subject-field-using-Qlik/ta-p/1859275</link>
    <description>&lt;P&gt;When sending emails using the Mail Connector in Qlik Application Automation, special characters in the Subject field may not be correctly formatted.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;In Qlik Application Automation:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mail subject.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66639i4DE086FC6D37322B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mail subject.png" alt="Mail subject.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Email received:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mail received.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66641i2F6F34B19A55FAC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mail received.png" alt="Mail received.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H3&gt;Solution&lt;/H3&gt;
&lt;P&gt;The Send Mail block does not have native support for special characters in the Subject input field, but only supports UTF-8 characters.&amp;nbsp; To use special characters, a Custom Code block can be used with some PHP code to format the text string to be used by the Subject input field.&lt;/P&gt;
&lt;P&gt;Do the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a Custom Code block and place it before the Send Mail block&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Automation flow.png" style="width: 334px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66645iAD16A7C31F3DC2DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Automation flow.png" alt="Automation flow.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;Select the Custom Code block and make sure Language is set to PHP 7.4&lt;/LI&gt;
&lt;LI&gt;Change one of the default inputs to "Subject" and delete the second default input&lt;/LI&gt;
&lt;LI&gt;Paste the following code into the code block, replacing the example code&lt;BR /&gt;&lt;LI-CODE lang="php"&gt;$subject = $inputs['Subject'];
$subj = addcslashes(mb_encode_mimeheader($subject, "UTF-8", "Q"), '"');
echo $subj;
?&amp;gt;
​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Here's the final Custom Code Block&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Custom codeblock no subject.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66642iB6062EE4DABFF80E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Custom codeblock no subject.png" alt="Custom codeblock no subject.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Edit the Send Mail block and set Subject input to use the output from the above Custom Code block&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mail subject input codeblock.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66643i341924200F3FC44A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mail subject input codeblock.png" alt="Mail subject input codeblock.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Open the Custom Code block and enter the text to be used as a subject in the mail being sent&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Custom codeblock subject.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66644iC9657BE7D457951F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Custom codeblock subject.png" alt="Custom codeblock subject.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Run the automation to verify special characters are being correctly formatted in the email subject&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mail subject correct.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66646i0E0A08470256F664/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mail subject correct.png" alt="Mail subject correct.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;
&lt;H4&gt;Environment&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;LI-PRODUCT title="Qlik Application Automation" id="qlikApplicationAutomation"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-style: italic;"&gt;The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Nov 2021 07:11:04 GMT</pubDate>
    <dc:creator>Bjorn_Wedbratt</dc:creator>
    <dc:date>2021-11-22T07:11:04Z</dc:date>
    <item>
      <title>How to handle special characters in the Subject field using Qlik Application Automation Mail Connector</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-handle-special-characters-in-the-Subject-field-using-Qlik/ta-p/1859275</link>
      <description>&lt;P&gt;When sending emails using the Mail Connector in Qlik Application Automation, special characters in the Subject field may not be correctly formatted.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;In Qlik Application Automation:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mail subject.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66639i4DE086FC6D37322B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mail subject.png" alt="Mail subject.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Email received:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mail received.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66641i2F6F34B19A55FAC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mail received.png" alt="Mail received.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H3&gt;Solution&lt;/H3&gt;
&lt;P&gt;The Send Mail block does not have native support for special characters in the Subject input field, but only supports UTF-8 characters.&amp;nbsp; To use special characters, a Custom Code block can be used with some PHP code to format the text string to be used by the Subject input field.&lt;/P&gt;
&lt;P&gt;Do the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a Custom Code block and place it before the Send Mail block&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Automation flow.png" style="width: 334px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66645iAD16A7C31F3DC2DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Automation flow.png" alt="Automation flow.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;Select the Custom Code block and make sure Language is set to PHP 7.4&lt;/LI&gt;
&lt;LI&gt;Change one of the default inputs to "Subject" and delete the second default input&lt;/LI&gt;
&lt;LI&gt;Paste the following code into the code block, replacing the example code&lt;BR /&gt;&lt;LI-CODE lang="php"&gt;$subject = $inputs['Subject'];
$subj = addcslashes(mb_encode_mimeheader($subject, "UTF-8", "Q"), '"');
echo $subj;
?&amp;gt;
​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Here's the final Custom Code Block&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Custom codeblock no subject.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66642iB6062EE4DABFF80E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Custom codeblock no subject.png" alt="Custom codeblock no subject.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Edit the Send Mail block and set Subject input to use the output from the above Custom Code block&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mail subject input codeblock.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66643i341924200F3FC44A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mail subject input codeblock.png" alt="Mail subject input codeblock.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Open the Custom Code block and enter the text to be used as a subject in the mail being sent&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Custom codeblock subject.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66644iC9657BE7D457951F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Custom codeblock subject.png" alt="Custom codeblock subject.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Run the automation to verify special characters are being correctly formatted in the email subject&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mail subject correct.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/66646i0E0A08470256F664/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mail subject correct.png" alt="Mail subject correct.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;
&lt;H4&gt;Environment&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;LI-PRODUCT title="Qlik Application Automation" id="qlikApplicationAutomation"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-style: italic;"&gt;The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 07:11:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-handle-special-characters-in-the-Subject-field-using-Qlik/ta-p/1859275</guid>
      <dc:creator>Bjorn_Wedbratt</dc:creator>
      <dc:date>2021-11-22T07:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle special characters in the Subject field using Qlik Application Automation Mail Connector</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-handle-special-characters-in-the-Subject-field-using-Qlik/tac-p/1968079#M7085</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Although I don't have special characters and I have an error with send mail in automation: "Malformed UTF-8 characters, possibly in correctly encoded".&lt;/P&gt;
&lt;P&gt;I have tried this solution but I have the same error.&lt;/P&gt;
&lt;P&gt;Do you know another reason for this error?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 07:08:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-handle-special-characters-in-the-Subject-field-using-Qlik/tac-p/1968079#M7085</guid>
      <dc:creator>jalbalat</dc:creator>
      <dc:date>2022-08-12T07:08:22Z</dc:date>
    </item>
  </channel>
</rss>

