Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Notification emails are not containing Enters inside the questions/answers/comments added in the forum

+3 votes
49 views
asked Aug 8 in Q2A Core by jfiricel

This is a continuation of question https://www.question2answer.org/qa/65763/how-to-change-text-format-of-the-content-notification-emails ...

1) I have enabled the HTML notification emails as per https://www.question2answer.org/qa/65763/how-to-change-text-format-of-the-content-notification-emails?show=65785#a65785  (observation: i needed to do both changes, meaning also in users-edit.php and in emails.php otherwise the registration was not working properly).

2) I have also replaced the $params['text'] with $params['content'] in the qa-notify-event.php file. The content of this file can be seen here: https://github.com/jfiricel/qa/blob/master/qa-event-notify.php.

3) I have updated my qa-lang-emails.php file content to contain HTML text. Check the content of the file here: https://github.com/jfiricel/qa/blob/master/qa-lang-emails.php.

4) When i'm adding a new question into the forum, written on multiple lines, the notification email that is received is containing the question written on a single line. The same will happen for answers, comments...


Can you please tell me what else i must change or what i'm doing wrong in order to fix this issue?

Q2A version: 1.8

1 Answer

+1 vote
answered Aug 9 by pupi1985

I liked the idea of uploading the changes to the core that you've made. You can also clone the Q2A repository to your Github account and then just edit the files online and do a commit after that (I think it happens automatically). Then getting a diff of the changes is super easy.

Specifically answering your question, I've taken the files locally to my installation, asked a question, and then got the email properly formatted. I'm assuming you're talking about the A new question has been asked by... email. It also was received in the appropriate content type: text/html; charset=utf-8

So there is something else going on. Look in your email client a Show original email (or something like that)to see the content of the email you're really receiving. Paste it in your question removing any relevant content. It won't be possible to provide help without that.

  1. Are you using the WYSIWYG editor? If not which one?
  2. Are you getting the same results in different email clients? (e.g.: Google, Yahoo, etc)
commented 5 days ago by jfiricel
edited 5 days ago by jfiricel
I have no problem to commit these changes once they are working as expected. You say to directly commit them into dev branch right? I'm also fine if you just take them and commit them accordingly :) .

I have struggled to investigate what can be the problem with the emails in my DEV area (windows). No success :(  maybe some caching or who knows...anyway it is not that important, my objective is the production area.
In the end i had deploy the changes in PROD area (linux). Indeed the "A new question has been asked by..." and "Your question has been answered by..." emails are just fine here.
But, the emails with "Your answer has a new comment by..." emails are still not ok :((.
Is there a change at comment level also to be done somewhere? (you can check here https://github.com/jfiricel/qa all the files i have changed for this issue ...search for "Justina" in the files)

I had a look also at the "Show Original" content of emails ... it seems that for the "new question" and "new answer" the content is included between <p></p> tags, it is including also <br> tags... But in the content of emails with "new comment" those are missing ...and they are missing for the comment but also for the answer inside the email ...

Regarding your questions:
1. Yes, I'm using WYSIWYG Editor plugin.
2. Yes...i tried in yahoo...google...outlook...

---------------------------------------------
Outlook question:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><dl><dt>A new question has been asked by <strong>justinaTest10</strong>:</dt><dd><i>
How to change notification email templates?</dd><dd><p style="color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;; font-size: 13px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Can somebody help me with changing the&nbsp;notification email templates in order to enable the HTML format?</p><p style="color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;; font-size: 13px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Thanks in advance!</p><p>Justina10</p>
</i></dd><br><dt>Click below to see the question:</dt><dd>https://developerforum.temenos.com/index.php/87/how-to-change-notification-email-templates</dd><br><dt>Thank you,</dt><dt>MarketPlace Provider Forum</dt></dl><p><small><b><i>Let us know what you think of our services!<br>Takes about a minute to complete our survey</i></b></small></p>

-----------------------------------
Gmail answer:
justinaTest10,<p></p><dl><dt>Your question on MarketPlace Provider Forum has been answered by <strong>jfiricel</strong>:</dt><dd><i>
<p>1) Enable the HTML notification emails as mentioned in https://www.question2answer.org/qa/65763/how-to-change-text-format-of-the-content-notification-emails?show=65785#a65785&nbsp; (observation: i needed to do both changes, meaning also in <em><strong>users-edit.php</strong></em> and in <strong><em>emails.php</em></strong> otherwise the registration was not working properly).<br>2) Replace the $params['text'] with $params['content'] in the qa-notify-event.php file. The content of this file can be seen here: https://github.com/jfiricel/qa/blob/master/qa-event-notify.php.<br>3) Update the <strong><em>qa-lang-emails.php</em></strong> file content to contain HTML text. Check the content of the file here: https://github.com/jfiricel/qa/blob/master/qa-lang-emails.php.<br>4) Enable html in below files:</p><ul><li>mailing.php</li><li>feedback.php</li><li>admin-um.php</li></ul><div>5) Let me know the results!</div>
</i></dd><br><dt>Your question was:</dt><dd><i>
How to change notification email templates?
</i></dd><br><dt>If you like this answer, you may select it as the best:</dt><dd>https://developerforum.temenos.com/index.php/87/how-to-change-notification-email-templates?show=91#a91</dd><br><dt>Thank you,</dt><dt>MarketPlace Provider Forum</dt></dl><p><small><b><i>Let us know what you think of our services!<br>Takes about a minute to complete our survey</i></b></small></p>

---------------------------------------------------
Gmail comment:
justinaTest10,<p></p><dl><dt>A new comment by <strong>jfiricel</strong> has been added after your comment on MarketPlace Provider Forum:</dt><dd><i>
I'm afraid I have no idea for the time being.
Let me investigate and come back to you.
Hope I will find a way..
it is so strange :(
</i></dd><br><dt>The discussion is following:</dt><dd><i>
1) Enable the HTML notification emails as mentioned in https://www.question2answer.org/qa/65763/how-to-change-text-format-of-the-content-notification-emails?show=65785#a65785  (observation: i needed to do both changes, meaning also in users-edit.php and in emails.php otherwise the registration was not working properly).
2) Replace the $params['text'] with $params['content'] in the qa-notify-event.php file. The content of this file can be seen here: https://github.com/jfiricel/qa/blob/master/qa-event-notify.php.
3) Update the qa-lang-emails.php file content to contain HTML text. Check the content of the file here: https://github.com/jfiricel/qa/blob/master/qa-lang-emails.php.
4) Enable html in below files:

mailing.php

feedback.php

admin-um.php

5) Let me know the results!
</i></dd><br><dt>You may respond by adding another comment:</dt><dd>https://developerforum.temenos.com/index.php/87/how-to-change-notification-email-templates?show=94#c94</dd><br><dt>Thank you,</dt><dt>MarketPlace Provider Forum</dt></dl><p><small><b><i>Let us know what you think of our services!<br>Takes about a minute to complete our survey</i></b></small></p>
commented 4 days ago by pupi1985
Contrary to what you're saying, I bet you're NOT using the WYSIWYG for comments, right? :)

If you want to send an HTML notification, you need to use an HTML editor. Set the WYSIWYG editor for comments, add a comment and let me know if that succeeds
commented 4 days ago by jfiricel
edited 4 days ago by jfiricel
Indeed, comments were not using WYSIWYG.
1) I set up the editor to WYSIWYG also for comments. I added a comment and no success. :((
Then i added a new comment but this time i changed the default font (name or size) to something else ...in this case the email notification received was containing Enters for comment part.
So, it seems i must choose a different font than the default one. I doubt a user will try to change the default format of name or size ... Is there a way to handle this?
Note: i also tried to change the qa-styles.css as explained http://www.question2answer.org/qa/33067/how-to-change-default-font-size-in-answers?show=33073#a33073 but this is only changing how you view the comment after is added and not how you write the comment.

2) Also, please take into account that the emails with the comments contains also a part with: "The discussion is following: ..." and there is mentioned the answer of the question but again this one is not containing enters :(
...