Not Solved [How To?] html code in messages.lang.php
#1
Not Solved
While HTML mails are possible in mass mail, it seems a little hard to achieve it in system messages, e.g. defined in messages.lang.php.

According this post
https://community.mybb.com/thread-101068...#pid738502
and for MyBB 1.6, it should be possible by editing the file functions.php
I've tried it and edited line 566 from

function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="[b]text[/b]", $message_text="", $return_email="")

to

function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="[b]html[/b]", $message_text="", $return_email="")

But it would not render any html. I also tried instead of 'html' the input 'both'.
Does anyone know if it is somehow possible to create system mails in html?

I would find html e-mails really useful as many mail clients on mobile devices do not link URL's unless they are sent in HTML format.
Reply
#2
Not Solved
Hi,

you could change the class_mailhandler.php file.

In line 99 change:
public $parse_format = 'text';

for html or both as you want (remember, no caps).

You'll have to change this file everytime MyBB updates it  Wink
I don't answer questions about localhost forums or forums without URL, I'm not a seer.  Cool
Reply
#3
Not Solved
Thank you for this suggestion. Just tested it using the internal messaging system to send an e-mail to a forum user.
The email still arrives in plain text. To test it, I added in Config > Languages > mylanguage > messages.lang.php in the respective box (email_sendtofriend) an HTML href link and some other html code.

The link and the other html content does not show up, also not as plain text. It seems to be somewhat more complicated.
Reply
#4
Not Solved
Hi again,

do you have this option enabled? 
Quote:Allow HTML

Selecting Yes will allow HTML to be used in private messages.
Admin CP -> Configuration (Tab) -> Settings -> Private Messaging
Maybe this was the problem with the email.
I don't answer questions about localhost forums or forums without URL, I'm not a seer.  Cool
Reply
#5
Not Solved
Thanks for that pointer. Just tested, but unfortunately this has only an effect om PM's , not on system mails. After all it's not a complete showstopper. Most mail clients on desktops will show the URL as a link. But many mobile mail apps, show the URL as plaintext. Thats a bit annoying, particularly if you get mail notifications about new replies where links are not clickable.

Keeping the finger on the plaintext link will copy the link so it can be used on a browser app, but it's not that pretty this way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)