Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
fix: require From header for RFC 5322 compliance (matches Gmail spec)
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Dec 23, 2019
1 parent 1c22bec commit c01635e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,12 @@ class ForwardEmail {
let rewriteFriendlyFrom = false;
// headers object (includes the \r\n\r\n header and body separator)
const { headers } = messageSplitter;
const originalFrom =
headers.getFirst('from') || session.envelope.mailFrom.address;
const originalFrom = headers.getFirst('from');

if (!originalFrom)
throw new CustomError(
'Your message is not RFC 5322 compliant, please include a valid "From" header.'
);

// parse the from address and set a parsed reply-to if necessary
const fromAddress = addressParser(originalFrom)[0];
Expand Down

0 comments on commit c01635e

Please sign in to comment.