aws-lambda-ses-forwarder icon indicating copy to clipboard operation
aws-lambda-ses-forwarder copied to clipboard

Setting 'From' doesn't work when sender email has no name element, causing unverified sender failure

Open Todderz opened this issue 5 years ago • 3 comments

When the sender is

Bilbo Baggins <[email protected]>

the regex for replacing the From address works. The part between < and > is removed, and the verified From address is added, leaving

From: Bilbo Baggins <[email protected]>

If the sender is just

[email protected]

then the removal of the original fails, leaving

From: [email protected] <[email protected]>

AWS scans the first item in the From header and fails with unverified sender.

message: 'sendRawEmail() returned error.',
  error: 
   { MessageRejected: Email address is not verified. The following identities failed the check in region EU-WEST-1: <[email protected]>

Have been using the function for over 12 months without problem until failures when the sender address is as described, surrounded by others still working correctly with the more usual sender format, so it's not anything to do with sandboxes or other config. The only difference I can see for the failed messages is the sender from address being as discussed.

This line: https://github.com/arithmetric/aws-lambda-ses-forwarder/blob/6522b9381450d2c88523af12581b2f27fc7e3ce7/index.js#L209

Todderz avatar Nov 14 '19 15:11 Todderz

I have the same issue and no idea to fix it for now. love to hear from others, thanks !

kevbarns avatar Jan 15 '20 17:01 kevbarns

This is already fixed by https://github.com/arithmetric/aws-lambda-ses-forwarder/pull/118

I merged it into my fork and it fixed the problem.

cregkly avatar Jul 07 '20 06:07 cregkly

Got the same problem. Going to validate #118 for my usecase.

// Edit#1 I have a slightly modified version but the solution provided in #118 is working 👍

christoph-kluge avatar Mar 29 '21 11:03 christoph-kluge