Skip to content

Conversation

@tolgamorf
Copy link

Added three new functions: getFrom(), getFromName() and getFromAddress()
They can be used to return the sender's display name and e-mail address.

Example:

$emailParser = new PlancakeEmailParser($email);

$emailFrom = $emailParser->getFrom();
$emailFromName = $emailParser->getFromName();
$emailFromAddress = $emailParser->getFromAddress();

Output:
$emailFrom: "John Doe" <[email protected]>
$emailFromName: John Doe
$emailFromAddress: [email protected]

Added three new functions:
`getFrom()`, `getFromName()` and `getFromAddress()`
They can be used to return the sender's display name and e-mail address.

Example:
`$emailParser = new PlancakeEmailParser($email);
$emailFrom = $emailParser->getFrom();
$emailFromName = $emailParser->getFromName();
$emailFromAddress = $emailParser->getFromAddress();`

`$emailFrom`: `"John Doe" <[email protected]>`
`$emailFromName`: `John Doe`
`$emailFromAddress`: `[email protected]`
I found out that some e-mail clients (i.e. iPhone Mail app) does not include quotes in `from` header. The updated code correctly parses the following forms:
`"John Doe" <[email protected]>
John Doe <[email protected]>`
@chrisforrence
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants