Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Emails don't need to have a To: header #73

@ulab

Description

@ulab

It's a good idea to add some recipients to an email, but these don't have to be in the To: header. Instead they could be in the "Cc:" or "Bcc:" header lines.

Because of this I think that these checks in Transport/Sendmail.php are not correct:

if (!$headers->has('to')) {
throw new Exception\RuntimeException('Invalid email; contains no "To" header');
}
$to = $headers->get('to');
$list = $to->getAddressList();
if (0 == count($list)) {
throw new Exception\RuntimeException('Invalid "To" header; contains no addresses');
}

According to RFC 5322 (http://tools.ietf.org/html/rfc5322) the only absolute necessary (as in MUST) headers are From: and Date:

The only required header fields are the origination date field and the originator address field(s). All other header fields are syntactically optional.

Of course there's usually no email that does not have a recipient, but the check should look for them in To:, Cc: and Bcc:.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions