Skip to content

Getter for the "Received" header "for" part #256

Description

@aprat84

Hi!

I wonder if it would be possible to have a getter to obtain the "for" part of the "Received" header, parsed and processed maybe as an AddressPart, or maybe as just an email.

I'm implementing some kind of receiving email application in AWS SES, and this is the only header I can rely to get the actual real recipient.

As of now, I'm using the follwing code to retrieve it:

/** @var ReceivedHeader $received */
$received = $mail->getHeader(HeaderConsts::RECEIVED);
$recipient = trim($received?->getValueFor('for') ?? '', '<>');

But as you can see, I have to, at least, trim the < and >.

So I wonder if the library could do it for us. Not just the trim, but every other parsing or post-processing that an email address may need.

Thanks!

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