email headers are http encoded

Neil Baleva 15 Reputation points
2024-06-25T20:08:44.8466667+00:00

When sending email through Azure Communication Services (either via the rest endpoint or smtp), oneclick unsubscribe headers are being http encoded. Please let me know if there is a way to ensure these headers are set correctly ?

Date: Tue, 25 Jun 2024 19:59:38 +0000
List-Unsubscribe: =?utf-8?q?=3Chttp=3A=2F=2Fcybercoders-dev=2Ecybercoders=2Enet=2Funsubscribe=2Fjobalerts?=
 =?utf-8?q?=2F=3Fe=3D0x0200000076E19F2146F1F1D97EAAB95EE897C048495BB19F5DA6F9F?=
 =?utf-8?q?9DDD46CC99D73A7E893A85410E216FB345B96B859B606D8CDB97F7FA98ED6?=
 =?utf-8?q?81F38E126659BF652FE7B1E12B8216B7818EBD5D379036F1BD39&rec=3DccJo?=
 =?utf-8?q?bAlerts&bu=3D1=3E?=
List-Unsubscribe-Post: =?utf-8?q?List-Unsubscribe=3Dccjobalert=3BEnv=3Ddev=3BEncEmail=3D0x0200000076E19F?=
 =?utf-8?q?2146F1F1D97EAAB95EE897C048495BB19F5DA6F9F9DDD46CC99D73A7E893A?=
 =?utf-8?q?85410E216FB345B96B859B606D8CDB97F7FA98ED681F38E126659BF652FE7?=
 =?utf-8?q?B1E12B8216B7818EBD5D379036F1BD39=3BEmail=3Djoe=2Eaure=40cybercoders=2Ec?=
 =?utf-8?q?om=3BBu=3D1=3B?=
MIME-Version: 1.0
Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
847 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 17,886 Reputation points
    2024-06-26T05:27:25.17+00:00

    @Neil Baleva The issue you're encountering is related to how Azure Communication Services is encoding the email headers, specifically the List-Unsubscribe and List-Unsubscribe-Post headers. These headers are being encoded using MIME Encoded-Word syntax (RFC 2047), which is typically used for non-ASCII characters in email headers. The encoding is happening because the headers contain special characters (like ":", "/", "?", "&", "=") that might be interpreted incorrectly by email clients if left unencoded.To resolve this issue and ensure the headers are set correctly, you can try the following solutions:

    1. Use plain ASCII characters only: If possible, modify your unsubscribe URLs to use only plain ASCII characters. This might involve URL-encoding certain parts of the link before setting it as a header.
    2. Instead of relying on Azure Communication Services to set these headers, try setting them yourself as custom headers. This might bypass the automatic encoding.

    Hope that helps.

    -Grace


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.