File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ console.log("AWS Lambda SES Forwarder // @arithmetric // Version 3.0.0");
77//
88// Expected keys/values:
99// - fromEmail: Forwarded emails will come from this verified address
10+ // - subjectPrefix: Forwarded emails subject will contain this prefix
1011// - emailBucket: S3 bucket name where SES stores emails.
1112// - emailKeyPrefix: S3 key name prefix where SES stores email. Include the
1213// trailing slash.
@@ -17,6 +18,7 @@ console.log("AWS Lambda SES Forwarder // @arithmetric // Version 3.0.0");
1718// The key must be lowercase.
1819var defaultConfig = {
1920 fromEmail : "noreply@example.com" ,
21+ subjectPrefix : "" ,
2022 emailBucket : "s3-bucket-name" ,
2123 emailKeyPrefix : "emailsPrefix/" ,
2224 forwardMapping : {
@@ -184,6 +186,15 @@ exports.processMessage = function(data, next) {
184186 return fromText ;
185187 } ) ;
186188
189+ // Add a prefix to the Subject
190+ if ( data . config . subjectPrefix ) {
191+ header = header . replace (
192+ / ^ S u b j e c t : ( .* ) / mg,
193+ function ( match , subject ) {
194+ return 'Subject: ' + data . config . subjectPrefix + subject ;
195+ } ) ;
196+ }
197+
187198 // Remove the Return-Path header.
188199 header = header . replace ( / ^ R e t u r n - P a t h : ( .* ) \r ? \n / mg, '' ) ;
189200
You can’t perform that action at this time.
0 commit comments