Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 11 Years, 8 Months ago E-mail Templates
#1
Solved: 11 Years, 8 Months ago
Hello,

I attempted to edit the language file to include my e-mail template but when I tested it out, it literally sent me an email full of HTML code.

What is the correct procedure for this?
#2
Solved: 11 Years, 8 Months ago
You'd need to do core edits.
Look in functions.php at my_mail:
/**
 * Sends an email using PHP's mail function, formatting it appropriately.
 *
 * @param string Address the email should be addressed to.
 * @param string The subject of the email being sent.
 * @param string The message being sent.
 * @param string The from address of the email, if blank, the board name will be used.
 * @param string The chracter set being used to send this email.
 * @param boolean Do we wish to keep the connection to the mail server alive to send more than one message (SMTP only)
 * @param string The format of the email to be sent (text or html). text is default
 * @param string The text message of the email if being sent in html format, for email clients that don't support html
 * @param string The email address to return to. Defaults to admin return email address.
 */
function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")

As you can see text messages are default. Then look for example in member.php, you'll notice that all my_mail functions keep the default "text" value for formatting.
#3
Solved: 11 Years, 8 Months ago
Do I just change "text" to "html"?
#4
Solved: 11 Years, 8 Months ago
In the function? Then you'd also need to specify $message_text in every MyBB my_mail call for people without HTML enabled in E-mails, I think, otherwise they'll get blank messages.

If you mean calls only, yes that should work if you provide also $message_text for every call you edit. Not sure though, I'm green at PHP/MyBB coding, so you better wait for someone more experienced.
#5
Solved: 11 Years, 8 Months ago
(2013-05-18, 11:56 PM)Knerba Wrote: Do I just change "text" to "html"?

If you're sure that you're ONLY going to use HTML format for sending out emails, than yes, in functions.php, replace
function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")

by

function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="html", $message_text="", $return_email="")
#6
Solved: 11 Years, 8 Months ago
Thanks for the help guys!
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)