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

Added ability to extract text and html from multipart messages #157

Merged

Conversation

kynx
Copy link

@kynx kynx commented Nov 16, 2023

I'm moving an application that uses vanilla laminas-mail to this library. It composes email messages with text, html and attachment parts pretty-much exactly as described in https://docs.laminas.dev/laminas-mail/message/attachments/#multipartalternative-emails-with-attachments, with a multipart/alternative part containing the text and html, followed by one or more parts for the attachments.

Currently this library doesn't look inside the multipart/alternative part, so never finds the text and html. This PR fixes that.

@@ -103,6 +103,69 @@ $message->setBody($body);

> For accessibility purposes, you should *always* provide both a text and HTML version of your mails.

### `multipart/alternative` emails with attachments
Copy link
Author

@kynx kynx Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've raised a PR against laminas/laminas-mail to fix what I think are issues with their documentation. If that's merged this section may not be needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kynx It seems they are merging your work :). So .. what do you think makes most sense here? Drop this PR, or merge it neverthless?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is still required so the text and html can be extracted from the multipart/alternative part. But I'll just link to the laminas docs for a (now correct) example of how to create the email in the first place.

@roelvanduijnhoven roelvanduijnhoven merged commit b40a982 into Webador:master Nov 17, 2023
8 checks passed
@roelvanduijnhoven
Copy link
Collaborator

Thanks @kynx. I've published pre-release v4.7.0-alpha. Can you test it out, and let me know if it works? I'll do the same on my end! And I'll publish a new release in a weeks time.

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.

None yet

2 participants