Skip to content

Update PlancakeEmailParser.php#13

Open
tolgamorf wants to merge 3 commits into
daniele-occhipinti:masterfrom
tolgamorf:patch-1
Open

Update PlancakeEmailParser.php#13
tolgamorf wants to merge 3 commits into
daniele-occhipinti:masterfrom
tolgamorf:patch-1

Conversation

@tolgamorf

Copy link
Copy Markdown

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" <john.doe@foo.com>
$emailFromName: John Doe
$emailFromAddress: john.doe@foo.com

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" <john.doe@foo.com>`
`$emailFromName`: `John Doe`
`$emailFromAddress`: `john.doe@foo.com`
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" <john.doe@email.com>
John Doe <john.doe@email.com>`
@c10ce

c10ce commented Jan 4, 2016

Copy link
Copy Markdown

👍

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