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

How can I get the X-Failed-Recipients? #227

Closed
Daniyal-Javani opened this issue Feb 3, 2018 · 1 comment
Closed

How can I get the X-Failed-Recipients? #227

Daniyal-Javani opened this issue Feb 3, 2018 · 1 comment
Assignees
Labels
need help Your support is required to solve this issue. needs investigation This will be tested / debugged or checked out.

Comments

@Daniyal-Javani
Copy link

Hello
I want to store email addresses that are failed so I need to get the X-Failed-Recipients, I can see it in email source but how can I get it through php-imap? I try getRawMail but it's not in there.

@Sebbo94BY
Copy link
Collaborator

@Daniyal-Javani do you have an example email (header) or at least the excerpt of it?

All other headers, which are not RFC compliant and not commonly used are retrieved using this piece of code for each single header, which we want:

$header->priority = (preg_match("/Priority\:(.*)/i", $headersRaw, $matches)) ? trim($matches[1]) : "";

See line 572.

So you could do something similar in your application code to get X-Failed-Recipients from the headersRaw:

$mail_header = $mailbox-> getMailHeader($mailId);
$failed_recipients = (preg_match("/Failed-Recipients\:(.*)/i", $mail_header->headersRaw, $matches)) ? trim($matches[1]) : "";

Contains some relevant information regarding the mentioned header: https://stackoverflow.com/questions/5298285/detecting-if-an-email-is-a-delivery-status-notification-and-extract-informatio

@Sebbo94BY Sebbo94BY self-assigned this Apr 30, 2019
@Sebbo94BY Sebbo94BY added need help Your support is required to solve this issue. needs investigation This will be tested / debugged or checked out. labels Apr 30, 2019
Sebbo94BY added a commit that referenced this issue May 5, 2019
- Updated README
- Move phpunit to require-dev
- Add note about installing dev dependencies in README
- Replaced spaces with tabs
- Added PHPUnit tests for MIME decoding
- Updated formatting of PHPUnit function testParsedDateTimeWithEmptyHeaderDate()
- Issue #209: Function to parse datetime correctly RFC2822
- Issue #280: Added 'Sender' to headers and added additional if-conditions 
- Issue #115: getMail() method returns an object even for nonexistent mail ID
- Issue #273: Added connection check to example
- Issue #227: Added Failed-Recipients to IncomingMailHeader
- Issue #140, #246: Improved exception handling and added PHPUnit test
- Issue #140: Added PHPUnit test for testing ConnectionException
- Issue #140: Improved exception / error handling and improved / added PHPUnit tests
- Issue #154: Added ability to change the imap_search option from SE_UID to SE_FREE and added PHPUnit tests
- Issue #306: Added support for US-ASCII and added ability to disable serverEncoding for searchMailbox()
- Imported missing namespaces to avoid 'unknown class' error messages
- Issue #86: Simplified and improved one replace regex for attachment file names
- Issue #247: Improved grabbing of fromName, fromHost, senderName and senderHost
- Issue #39, #71, #229: Fixed body content gets incorrectly processed as attachments
- Issue #122, #150, #167: Added ability to skip processing of attachments to increase performance, when attachments are not required
- PR #284: Added missing PHPUnit tests
- Issue #122, #150, #167: Lazy load message text and attachments data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need help Your support is required to solve this issue. needs investigation This will be tested / debugged or checked out.
Projects
None yet
Development

No branches or pull requests

2 participants