Open
Conversation
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
I can push this to 1.10 if we don't want to rush here.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for dynamic email recipients in the
emailformat for Posit Connect. Recipients can now be computed programmatically via Python or R code and specified in multiple formats.Key Features
write_yaml_metadata_block()in R or equivalent in Python)v2 Metadata Structure
We now return v2 which looks identical to the changes in #13882, but with a recipients field:
{ "emails": [ { "attachments": [], "body_html": "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\"> <!-- utf-8 works for most cases -->\n<meta name=\"viewport\" content=\"width=device-width\"> <!-- Forcing initial-scale shouldn't be necessary -->\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> <!-- Use the latest (edge) version of IE rendering engine -->\n<meta name=\"x-apple-disable-message-reformatting\"> <!-- Disable auto-scale in iOS 10 Mail entirely -->\n<meta name=\"format-detection\" content=\"telephone=no,address=no,email=no,date=no,url=no\"> <!-- Tell iOS not to automatically link certain text strings. -->\n<meta name=\"color-scheme\" content=\"light\">\n<meta name=\"supported-color-schemes\" content=\"light\">\n<!-- What it does: Makes background images in 72ppi Outlook render at correct size. -->\n<!--[if gte mso 9]>\n<xml>\n<o:OfficeDocumentSettings>\n<o:AllowPNG/>\n<o:PixelsPerInch>96</o:PixelsPerInch>\n</o:OfficeDocumentSettings>\n</xml>\n<![endif]-->\n<style>\nbody {\nfont-family: Helvetica, sans-serif;\nfont-size: 14px;\n}\n.content {\nbackground-color: white;\n}\n.content .message-block {\nmargin-bottom: 24px;\n}\n.header .message-block, .footer message-block {\nmargin-bottom: 12px;\n}\nimg {\nmax-width: 100%;\n}\n@media only screen and (max-width: 767px) {\n.container {\nwidth: 100%;\n}\n.articles, .articles tr, .articles td {\ndisplay: block;\nwidth: 100%;\n}\n.article {\nmargin-bottom: 24px;\n}\n}\n</style>\n</head>\n<body style=\"background-color:#f6f6f6;font-family:Helvetica, sans-serif;color:#222;margin:0;padding:0;\">\n<table width=\"85%\" align=\"center\" class=\"container\" style=\"max-width:1000px;\">\n<tr>\n<td style=\"padding:24px;\">\n<div class=\"header\" style=\"font-family:Helvetica, sans-serif;color:#999999;font-size:12px;font-weight:normal;margin:0 0 24px 0;text-align:center;\">\n</div>\n<table width=\"100%\" class=\"content\" style=\"background-color:white;\">\n<tr>\n<td style=\"padding:12px;\">\n<p>First email HTML content.</p>\n</td></tr>\n</table>\n<div class=\"footer\" style=\"font-family:Helvetica, sans-serif;color:#999999;font-size:12px;font-weight:normal;margin:24px 0 0 0;\">\n<p>This message was generated on 2026-01-16 16:15:12.</p>\n\n<p>If HTML documents are attached, they may not render correctly when viewed in some email clients. For a better experience, download HTML documents to disk before opening in a web browser.</p>\n</div>\n</td>\n</tr>\n</table>\n</body>\n</html>\n", "body_text": "Text version of first email.\n", "email_id": 1, "recipients": [ "a@example.com", "b@example.com", ], "send_report_as_attachment": false, "subject": "First Email Subject", "suppress_scheduled": false }, { "attachments": [], "body_html": "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\"> <!-- utf-8 works for most cases -->\n<meta name=\"viewport\" content=\"width=device-width\"> <!-- Forcing initial-scale shouldn't be necessary -->\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"> <!-- Use the latest (edge) version of IE rendering engine -->\n<meta name=\"x-apple-disable-message-reformatting\"> <!-- Disable auto-scale in iOS 10 Mail entirely -->\n<meta name=\"format-detection\" content=\"telephone=no,address=no,email=no,date=no,url=no\"> <!-- Tell iOS not to automatically link certain text strings. -->\n<meta name=\"color-scheme\" content=\"light\">\n<meta name=\"supported-color-schemes\" content=\"light\">\n<!-- What it does: Makes background images in 72ppi Outlook render at correct size. -->\n<!--[if gte mso 9]>\n<xml>\n<o:OfficeDocumentSettings>\n<o:AllowPNG/>\n<o:PixelsPerInch>96</o:PixelsPerInch>\n</o:OfficeDocumentSettings>\n</xml>\n<![endif]-->\n<style>\nbody {\nfont-family: Helvetica, sans-serif;\nfont-size: 14px;\n}\n.content {\nbackground-color: white;\n}\n.content .message-block {\nmargin-bottom: 24px;\n}\n.header .message-block, .footer message-block {\nmargin-bottom: 12px;\n}\nimg {\nmax-width: 100%;\n}\n@media only screen and (max-width: 767px) {\n.container {\nwidth: 100%;\n}\n.articles, .articles tr, .articles td {\ndisplay: block;\nwidth: 100%;\n}\n.article {\nmargin-bottom: 24px;\n}\n}\n</style>\n</head>\n<body style=\"background-color:#f6f6f6;font-family:Helvetica, sans-serif;color:#222;margin:0;padding:0;\">\n<table width=\"85%\" align=\"center\" class=\"container\" style=\"max-width:1000px;\">\n<tr>\n<td style=\"padding:24px;\">\n<div class=\"header\" style=\"font-family:Helvetica, sans-serif;color:#999999;font-size:12px;font-weight:normal;margin:0 0 24px 0;text-align:center;\">\n</div>\n<table width=\"100%\" class=\"content\" style=\"background-color:white;\">\n<tr>\n<td style=\"padding:12px;\">\n<p>Second email HTML content.</p>\n</td></tr>\n</table>\n<div class=\"footer\" style=\"font-family:Helvetica, sans-serif;color:#999999;font-size:12px;font-weight:normal;margin:24px 0 0 0;\">\n<p>This message was generated on 2026-01-16 16:15:12.</p>\n\n<p>If HTML documents are attached, they may not render correctly when viewed in some email clients. For a better experience, download HTML documents to disk before opening in a web browser.</p>\n</div>\n</td>\n</tr>\n</table>\n</body>\n</html>\n", "body_text": "Text version of second email.\n", "email_id": 2, "recipients": [ "c@example.com", "d@example.com", ], "send_report_as_attachment": false, "subject": "Second Email Subject", "suppress_scheduled": false } ], "rsc_email_version": 2 }Dynamic recipients (inline Python/R):
Dynamic recipients (metadata Python):
Dynamic recipients (metadata R):
Closes #14023
Checklist
I have (if applicable):