- Newest
- Most votes
- Most comments
Hello.
As far as I know, if you are using the email endpoint with Amazon SNS, you cannot format the message to HTML and send it.
If you want to format it as HTML and send an email, I think you need to use something like Amazon SES.
https://stackoverflow.com/questions/62807325/python-boto3-sns-email-formatting-with-html
Given that you're using SNS with email subscriptions and Outlook as the email client, there are a few alternative approaches you can try:
- Plain text with URL description: Instead of using HTML, you can format your message using plain text with a description followed by the URL. For example:
message = f"{f['Remediation']['Recommendation']['Text']}: Click here for remediation ({f['Remediation']['Recommendation']['Url']})"
This approach provides both a description and the full URL, which Outlook should automatically convert to a clickable link.
-
Use the displayText field: If you're using AWS User Notifications, you can utilize the displayText field for URL type text parts. This field allows you to provide a short, single-line description of the link, which will be hyperlinked with the URL itself. The maximum length for this field is 1024 characters.
-
Ensure proper SNS message formatting: When sending the message through SNS, make sure you're setting the correct message format. For email notifications, you may need to set the "MessageStructure" parameter to "json" and include both a "default" and an "email" message format.
-
Check SNS configuration: Verify that your SNS topic and subscription are correctly configured for email delivery. Ensure that the email protocol is selected and that the endpoint (email address) is correct.
-
Investigate URL rewriting: The URL in your example appears to be rewritten by a security service (urldefense.proofpoint.com). This rewriting might be interfering with the link formatting. You may need to consult with your IT department to see if there's a way to bypass or modify this URL rewriting for internal AWS notifications.
If these suggestions don't resolve the issue, you may need to consult with your organization's email administrators or AWS support for further assistance, as there might be specific security policies or email configurations affecting the link rendering in Outlook.
Sources
how can I label a url in a lambda python function used in a SNS message? | AWS re:Post
TextPartValue - AWS User Notifications
Relevant content
- AWS OFFICIALUpdated 3 years ago
