Skip to content

Retain Original 'From'-Email-Address #134

@hacnet

Description

@hacnet

Hi, fromText details are often insufficient, so I brought back the original From-Email-Address, while replacing the @ sign so that it doesn't interfere with the verified sender:

  // SES does not allow sending messages from an unverified address,
  // so replace the message's "From:" header with the original
  // recipient (which is a verified domain)
  header = header.replace(
    /^from:[\t ]?(.*(?:\r?\n\s+.*)*)/mgi,
    function(match, from) {
      var fromText;
      if (data.config.fromEmail) {
//    fromText = 'From: ' + from.replace(/<(.*)>/, '').trim() +
//    fromText = 'From: ' + from.replace(/<|>|/g, '').replace('@', '.').trim() +
      fromText = 'From: ' + from.replace(/<|>|/g, '').replace(/@/g, '.').trim() +
        ' <' + data.config.fromEmail + '>';
      } else {
        fromText = 'From: ' + from.replace('<', 'at ').replace('>', '') +
        ' <' + data.originalRecipient + '>';
      }
      return fromText;
    });

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