Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PlancakeEmailParser.php #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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