:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): use the sender's default reply-to when the email step has none (#115953)
Meikel Ratz66ffaa2506aa
diff --git a/nodejs/src/cdp/services/messaging/email.service.test.ts b/nodejs/src/cdp/services/messaging/email.service.test.tsindex adf73135e11a..cc3d8dee6d85 100644--- a/nodejs/src/cdp/services/messaging/email.service.test.ts+++ b/nodejs/src/cdp/services/messaging/email.service.test.ts@@ -1356,6 +1356,31 @@ describe('EmailService', () => {])})+ it.each([+ ['uses the sender default when the step has none', undefined, ['[email protected]']],+ ['uses the sender default when the step has no parsed addresses', ' , ', ['[email protected]']],+ ['keeps the step reply-to over the sender default', '[email protected]', ['[email protected]']],+ ])('%s', async (_, replyTo, expected) => {+ await insertIntegration(hub.postgres, team.id, {+ id: getIntegrationId(2),+ kind: 'email',+ config: {+ email: '[email protected]',+ name: 'Test User',+ domain: 'posthog-test.com',+ verified: true,+ provider: 'ses',+ reply_to: '[email protected]',+ },+ })+ sendEmailSpy.mockResolvedValue({ MessageId: 'test-message-id' })+ invocation.queueParameters = createEmailParams({ from: { integrationId: 2 }, replyTo })+ const result = await service.executeSendEmail(invocation)+ expect(result.error).toBeUndefined()+ const sentCommand = sendEmailSpy.mock.calls[0][0] as { input: any }+ expect(sentCommand.input.ReplyToAddresses).toEqual(expected)+ })+it.each([['text only', { html: '', text: 'Hello, this is a plain text email.' }, ['Text']],['html only, no text', { html: '<p>Hello</p>', text: undefined }, ['Html']],diff --git a/nodejs/src/cdp/services/messaging/email.service.ts b/nodejs/src/cdp/services/messaging/email.service.tsindex f1c3571e49f6..0fda911ecf0e 100644--- a/nodejs/src/cdp/services/messaging/email.service.ts+++ b/nodejs/src/cdp/services/messaging/email.service.ts@@ -571,12 +571,18 @@ export class EmailService {return result}+ // A reply-to set on the email step wins over the sender's default.+ const paramsWithReplyTo =+ parseAddressList(params.replyTo) || !integration.config.reply_to+ ? params+ : { ...params, replyTo: integration.config.reply_to }+// Tagged before click tracking wraps the links, so the tags land on the destination URL.const metadata = invocation.hogFunction.metadataconst sendParams =metadata?.utm_tags_enabled === true && params.html? {- ...params,+ ...paramsWithReplyTo,html: addUtmTagsToEmail(params.html,resolveUtmTags(@@ -596,7 +602,7 @@ export class EmailService {this.siteUrl),}- : params+ : paramsWithReplyToswitch (integration.config.provider ?? 'ses') {case 'maildev':