Skip to content

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

@Todderz

Description

@Todderz

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:

fromText = 'From: ' + from.replace(/<(.*)>/, '').trim() +

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions