4
votes

We use an application that sends email notifications to registered users based on the application workflow logic. We use AWS SES SMTP configurations and credentials. The setting works and emails are delivered.

However, I want to intercept the outgoing emails and modify the Subject by adding a prefix based on the AWS environment. For example, if we are in the test environment, I would like to prefix the subject with [TEST]. Since the application does not allow this type of customization, I am wondering if this action can be performed by a custom lambda function or AWS SES.

I have reviewed some of the questions here that intercept and save emails to S3 but none of those questions address or reference an outgoing email function hook. Is there a way to intercept and modify the Subject line on AWS?

1
I'm not aware of a way to insert Lambda into the outbound SES flow. Perhaps you could create an SMTP proxy that clients send to? - jarmod
We are using SES SMTP endpoints for us-east region. Do you mean that I have to create my own SMTP server and relay through SES SMTP? - Saeed D.
I'm not saying that you have to, just that I am not aware of a native way to do what you want (others might know). So I am proposing one option that might help you, which is to insert an SMTP proxy/relay (postfix?) in the middle. - jarmod
I don't believe there is a way to do this. Is there a reason you can't do that at the application level? - Jason Wadsworth
@jason the email is sent from a third-party product that only allows configuration settings for the SMTP server info. Subject is also set by the application depending on the alert. - Saeed D.

1 Answers

0
votes

No: there is no SES -> Lambda event for outgoing messages, only incoming messages, see AWS Lambda SES Integration docs.

I would suggest routing your outgoing messages to SNS or SQS, through Lambda, then to SES.