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
Add new message preview field to campaign composer for mail client previews #654
Conversation
|
CI errors As this issue is project-wide I'll leave it to others to resolve |
|
@samtuke the problem is now fixed in master, if you rebase the PR should pass |
Thanks; done |
|
@samtuke I don't think the following bit is working properly:
If you paste your entire HTML campaign in the content tab using the "source" option and generate the preview you will end up with the styling properties in the preview. |
|
Thanks for testing! From memory, the backend logic is identical to the button which generates plain text on the text tab, so I dont immediately understand how it's possible that CSS or html could be included in the preview. However I'll debug it. |
Good point. I copied them from
I didn't realise that functionality was included there. Personally, as a user, I think preheader is important enough to be moved to core, at some stage (or the plugin to be shipped with core).
Ouch, great point. I guess the template must be combined with the html to catch that. Which is more complex...
Was there no content in that campaign apart from the "About us" footer then? The implementation in this PR uses the |
Fixed in 750721d |
|
@samtuke can you rebase your code on the latest master to avoid the irrelevant commits that bring your code up to the master? |
b61fe44
to
78dbd7f
Compare
It was already rebased, now force-pushed, should be clean |
|
@bramley assuming that the template issue can be resolved, it seems this feature will always need to be used in combination with the content areas plugin's preheader field, in order to know the preview text for the widest amount of mail clients. That's inconvenient and potentially misleading for the user of either solution in the absence of the other, it seems to me. Ideally users want a single place they can set the preview text, or at least see it, not two different ones. Not sure of the solution. |
|
It's a great addition. It's quite common these days. Things I've noticed: |
I didn't mean to suggest that people use the Content Areas plugin, as I think it is a bit too difficult to use, but having a preheader field lets the admin specify exactly what additional text appears. I don't use enough email clients to know which will not use preheader, in which case this addition of preview is useful. |
With 503bf10 the plaintext campaign text is used in the preview, if it exists, instead of new text generated from the HTML as before. However for users which have the text tab disabled, which is presumably the majority, their only option to improve the preview with this PR's implementation is to change the start of their HTML content (which is then used as the basis for generated plaintext when messages are generated). Inserting (and editing) a "preheader" (by which I mean invisible text at the top of the HTML content hidden using style rules) could be added to this PR to give users the ability to change the preview without changing their campaign content - eg as two separate buttons next to the existing 'Generate'. However doing that would 1. duplicate functionality of the content areas plugin, and 2. Cause problems for plaintext users, as the preheader text would unexpectedly be visible for plaintext campaign readers (and users would not know this while editing thanks to missing 'text' tab). Thoughts @bramley ? |
@samtuke as @bramley said the Content Areas plugin is a little bit complex and I don't think that will be included by default anytime soon, and I agree that including preheader option would be a good addition as a core functionality.
Maybe this can be implemented so that the preheader is only entered in the HTML version of the email. Additionally, enabling the Text tab by default would also be an option. I think at this point this PR is successful in creating an idea on what the preview in most mail clients would be. I would also like to hear what @bramley thinks before including this in this release. |
|
Thanks @suelaP.
Right now I don't see how, as the plaintext version is always generated from HTML after the campaign is queued. Maybe we could do something like: 1. insert preheader from the html editing page 2. Check if text tab is visible 3a. Force generation and saving of text version if text tab is invisible, as part of setting the preheader in HTML 3b If text tab is visible: display warning and link that they should use it and review text version. Thoughts? |
Yes, I think that would be the best approach. |
|
@samtuke @suelaP You might be misunderstanding where the content of a message is stored. When sending an html-format email or a plain text-format email the content is always in the 'message' field. The 'textcontent' field is used only for a user-entered text alternative when sending an html-formatted email, which isn't of interest for generating the preview text. The issue then is deciding whether the message field actually contains html or text. Elsewhere phplist compares the field with the result of using strip_tags() to decide whether it contains html. There are some edge-cases that might not fit into this. Someone can select html-format on the Format tab, disable the editor, and enter plain text in the content field on the Compose tab. phplist will then convert the plain text to html when sending. But for this purpose, using the plain text directly is probably fine. I still think that the result needs to include wrapping the message field in the template when that is specified. |
Thank you for your comments @bramley . There are definitely cases when this would not work as expected and "real-life" usage of this would provide some more accurate feedback. I will merge this PR so that the functionality is included in 3.5.4 and use this Mantis issue: https://mantis.phplist.org/view.php?id=20212 to keep track of changes that can improve this. I think breaking it into smaller issues might make it easier for people to invest some time in things that concern them most. We could also add a flag so people can disable it in the future if they don't make much use of it. |
|
@suelaP Hi, I suggest this change is not included yet. It is not simply edge-cases but the main use-case of a campaign using a template is not handled, along with replacing placeholders. I really think that it needs a bit more thought on what it is trying to achieve. I think that the aim is to generate the same, or at least very similar, text as say Yahoo mail or Gmail generate. That is what I meant by wanting to see some real-world examples. If the generated text is not similar enough then this change isn't going to be useful. |
|
Maybe we should use a constant to enable it or not, so it can be selectively reviewed by more people? |





Description
~All popular mobile mail clients include a preview of email content as well as the subject line. This is common functionality among other ESPs.
The text preview is currently hard to know using phpList unless you send a test message. Mail clients read the plaintext version of the message and take the first 35-90 chars for preview. In phpList the 'text' tab is optional, and often disabled. In such cases it's not possible to know the mail client preview before sending the campaign (when plaintext version is presumably generated at queue processing time).
Therefore this PR adds a message preview to the html campaign composer page (content tab). It has simple logic, using the existing backend functions for retrieving saved message content and turning into plaintext. It also removes newlines and other problematic characters. Via a new ajax file and call it loads the saved html campaign content and turns into plaintext, abbreviated to 90 chars. This is then shown to the admin in a non-editable input text field.
This implementation seems to work for my and hopefully general use cases. However it has some shortcomings:
lists/admin/actions/generatetext.phpRelated Issue
None that I can find
Screenshots (if appropriate):