Skip to main content
Topic: Notification email does not send proper html (Read 884 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Notification email does not send proper html

ElkArt v1.1.6 on PHP v7.3.24

Parts of my community would like to use the forum as if it were a maillist. I found out how to activate the maillist function, and users have set their notifications accordingly. They get notified when a new topic or reply is posted. So far, so good ..

I have several problems though in understanding how this is supposed to work:

1. Notifications are sent as text emails, always
After some research in the source code, I found that the Notification module ultimately calls the sendmail() function in Mail.subs.php. One of the parameters to that function is the boolean variable "$send_html", and I assume this is what should control whether html mail should be sent (is that correct?).
If that's true, the call for Notification has hard wired the parameter "$send_html" to false. I couldn't find anything in the Administrator or user settings panels to control this flag. Is there any means to send notifications as html?

2. Sent html mails are incorrect
Following my question 1, I have changed the call to sendmail() to enforce "$send_html" to true. The mails are sent out, but the result is disappointing to say the least.

  • The mail is sent as a multipart message (correct)
  • First part is the plain text message (correct)
  • Second part is the html message (correct)

Looking at the message source code, the html part itself is wrong in many aspects though. It is only adding this tag:

Code: [Select]
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

.. followed by the markdown version of the message body. No traces of html can be found anywhere. Also, html, head, and body tags are missing completely.

Any hint is highly appreciated. Please let me know if I could give more information or detail to describe the problem.





Re: Notification email does not send proper html

Reply #1
I don't want to side-track your issue JP, but I suspect  you'll have to write the code to insert the missing head and body and html content (hence "$send_html"=false), and then you may run into another issue down-stream..  Users will then want to email attachments and the code is not there to handle that either (at least I haven't found it, which isn't saying too much anyway)..

{There were some attachment issues a few builds back discussed here but I don't know if or how that was addressed. I don't get attachments emailed into the forum in the latest release 1.1.6 anyway. }

Plus, every board has its own email address if the user wants to start a new topic in a board via email (without replying to an email from that board) - that is probably going to be (if not already) onerous for your "old dog" users as well.  Not like the typical mail-list where everything goes into one bucket..

I too have a large body of mail-users, and they are learning that there are limits to "remote" use of the forum.

But, if the forum page is book-marked in their browser, and they saved their forum log-in, it's 2-3 mouse clicks and they're in the forum live. Otherwise they are stuck with plain text emails (which serves 90% of their traffic anyway.).

It's admirable for you to go the extra parsecs in support of your users, but it's a lot easier for them to learn to access and use the forum when they want "full-feature" support,, than you writing the html code send/receive and attachment parsing (don't forget those 'multipart' users running Pegasus, et. al. - I found that really goofs up the attachment parsing with another "email-supporting" forum I was working with earlier).

But if you do go down that road and get it to work, let me know..  ;D
__________________________________________________________________________
// Deep inside every dilemma lies a solution that involves explosives //

 

Re: Notification email does not send proper html

Reply #2
Steeley,
thanks for your moral support!  :)

I will make a distinction between creating a topic and contributing to a thread. For creating topics we have exactly one email address in place. The post lands in a general section of the forum, as you rightfully described. From there the moderator adds labels and moves the new topic to the correct board. After the topic has been created people can lead the discussion via mail.

I understand that it is tempting to question that way of using a forum. Myself, I wouldn't do it that way either, as the browser is open on my machine all the time anyways.

Coming to the html question, I think that there is code in place already, somewhere. There is a lot of transformation going on between markdown, markdown with bbcode, plain text, and html. As I'm not familiar with the code and module structure I can only try to re-engineer to figure what is done and under what conditions. If I'm not mistaken there is also a branch that deals with attachments.

Honestly, I would say I'm not asking too much as html capabilities. Some preserving of line breaks, bold text, maybe lists, simple tables, and proper clickable links. If I could figure where and how to connect the existing parsers I could probably proceed.

Thanks for taking the time to reply!

Re: Notification email does not send proper html

Reply #3
> The post lands in a general section of the forum, as you > rightfully described. From there the moderator adds labels and moves > the new topic to the correct board.

Well, that will certainly keep your moderator busy, JP! :-)

(Me, I just hate being middleware..)

Press on my friend..

{for giggles I'll stick an attachment with this email reply and see if that is enabled on the  ElkArte forum. If it works, then I'll try to find out why it's not working on mine. If not, I'll just  stand by until a better man than I solves that issue.

-Steeley

On 26 Nov 2020 at 21:41, JPalmer via ElkArte Community wrote:

Steeley,

thanks for your moral support! :) > > I will make a distinction between creating a topic and contributing to > a thread. For creating topics we have exactly one email address in > place. The post lands in a general section of the forum, as you > rightfully described. From there the moderator adds labels and moves > the new topic to the correct board. After the topic has been created > people can lead the discussion via mail.

I understand that it is tempting to question that way of using a > forum. Myself, I wouldn't do it that way either, as the browser is > open on my machine all the time anyways.

Coming to the html question, I think that there is code in place > already, somewhere. There is a lot of transformation going on between > markdown, markdown with bbcode, plain text, and html. As I'm not > familiar with the code and module structure I can only try to > re-engineer to figure what is done and under what conditions. If I'm > not mistaken there is also a branch that deals with attachments.
 > Honestly, I would say I'm not asking too much as html capabilities.
 Some preserving of line breaks, bold text, maybe lists, simple tables, > and proper clickable links. If I could figure where and how to connect > the existing parsers I could probably proceed.

Thanks for taking the time to reply! >
__________________________________________________________________________
// Deep inside every dilemma lies a solution that involves explosives //

Re: Notification email does not send proper html

Reply #4
So, you replied by mail?
Your attachment ended up in my message, the one you replied to. Interesting ... and what we can say, there is some attachment handling in place!

If you want to check in your forum: there is a setting "Allow email file attachments to be posted ..." in Mailist Center -> Settings.

Re: Notification email does not send proper html

Reply #5
Yes, that was an email reply. Interesting, I don't see the attachment .. at all, anywhere. Did you delete it?

However, ending up in the wrong post was one of the bug reports in 1.1.3, that I linked a couple replies up ..so it looks like it persists unresolved..  I've REPOSTED the Bug report.

"Allow Email Attachments to be Posted" is checked..  so I feel like the little kid that wants the lights on when he goes to sleep: "How can I tell there's no boogie men under the bed if I can't see them?".   ::)

 Email attachments don't show up in my Forum either (or maybe, I haven't found what post it ended up in yet?)

But let's not chase *my* problem in your quest.. you haven't gotten to it yet.. :-)
__________________________________________________________________________
// Deep inside every dilemma lies a solution that involves explosives //

Re: Notification email does not send proper html

Reply #6
I never tested the post by email option included into elk,  so I cannot give any feedback on this. Anyway I see there is an attachments awaiting approval in this topic https://www.elkarte.net/community/index.php?topic=5886.msg41587#msg41587
I just approved the attachment
sorry for my bad english

Re: Notification email does not send proper html

Reply #7
I never tested the post by email option included into elk,  so I cannot give any feedback on this. Anyway I see there is an attachments awaiting approval in this topic https://www.elkarte.net/community/index.php?topic=5886.msg41587#msg41587
I just approved the attachment

AH! Now I can see it...  in the wrong post! That should have been in MY reply, not in JP's  post that I was replying to (although, being the equivalent of a "Like" in this case, why not, I suppose ??)  

I  haven't yet figured out why emailed attachments don't post at all in my forum ... nothing to approve as admin or moderator, and email attachments ARE enabled.. However, these attachment problems have detracted from JPs original topic, and has been (re)opened in a separate bug report, so I'll end this side track here. (JP, maybe we'll have this solved by the time it becomes an issue for you too as you bring your "distribution list" on-line.)
__________________________________________________________________________
// Deep inside every dilemma lies a solution that involves explosives //

Re: Notification email does not send proper html

Reply #8
2. Sent html mails are incorrect
Well... technically it's not entirely incorrect, what the parameter does is send an email in HTML format, and as per your checkpoints it does it correct. It just doesn't convert the body in HTML and nowhere is written it does, so, technically speaking the behaviour is the intended one and as such is not a bug. :D

If you want to have the body in HTML, you can tweak pbe_prepare_text in Emailpost.subs.php and drop:
Code: [Select]
	// Convert this to text (markdown)
$mark_down = new Html_2_Md($message);
$message = $mark_down->get_markdown();
Bugs creator.
Features destroyer.
Template killer.

Re: Notification email does not send proper html

Reply #9
When I did the original PBE I specifically did not allow outbound html and chose instead to use a MD version for outbound messages.

In bound messages it check if an HTML version is available and if found and ts not just a colossal hell space of HTML it will convert it to BBC for use.  It will fall back to the plain text version.   So much eMail HTML is just pure junk, really its a nightmare.
Be safe, Be kind, Happy Programing