Modifying EmailTemplates.english.php template

Started by DenDen60, February 27, 2015, 09:30:04 AM

Previous topic - Next topic

DenDen60

Is it possible to add a table in the body of an email.

I tried and it gave me : Template Parse Error!

'subject' => 'Welcome to {FORUMNAME}',

'body' => <table width="100%" border="0"><tr><td width="10%"> <align = "top"><img src="Images/main_51_69_Registration_CandS.png" /></td><td width="90%"><font size="8" color="blue">We are different</font><br></a><b><br><font size="3" color="red">Americans Building Better Societies Together</font></td></tr> </table>'Thank you for registering at {FORUMNAME}. Your username is {USERNAME}. If you forget your password, you can reset it by visiting {FORGOTPASSWORDLINK}.

Before you can login, you must first activate your account by selecting the following link:

{ACTIVATIONLINK}

Should you have any problems with the activation, please visit {ACTIVATIONLINKWITHOUTCODE} and enter the code "{ACTIVATIONCODE}".

{REGARDS}',
   ),

Kindred

you are missing the opening  single quote


'body' => '<table



oops... and you LEFT the single quote before the start of the text...  remove that


(and you know better than that, please use code tags when listing code :P)

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

DenDen60


DenDen60

Ok, I have no errors anymore, but I don't receive a formated message. :-(

This is what I receive as a message
Quote<table width="100%" border="0"><tr><td width="10%"> <align = "top"><img src="Images/main_51_69_Registration_CandS.png" /></td><td width="90%"><font size="8" color="blue">We are different</font><br></a><b><br><font size="3" color="red">Americans Building Better Societies Together</font></td></tr> </table>Thank you for registering at Citizens and Societies' United States Community. Your username is Claude Lemay. If you forget <b>your password</b>, you may change it at http://citizensandsocieties.net/NA-USA/index.php?action=reminder.

Regards,
The Citizens and Societies' United States Community Team.

margarett

Because SMF doesn't really send HTML mails... So your message is html code in plain text ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

DenDen60

Quote from: margarett on February 27, 2015, 10:19:33 AM
Because SMF doesn't really send HTML mails... So your message is html code in plain text ;)
Is there a way to make a small change somewhere to allow this, or is a big change.  :(

margarett

I never really did this but, looking at the code, if you change this
function sendmail($to, $subject, $message, $from = null, $message_id = null, $send_html = false, $priority = 3, $hotmail_fix = null, $is_private = false)
into
function sendmail($to, $subject, $message, $from = null, $message_id = null, $send_html = true, $priority = 3, $hotmail_fix = null, $is_private = false)

And this
function AddMailQueue($flush = false, $to_array = array(), $subject = '', $message = '', $headers = '', $send_html = false, $priority = 3, $is_private = false)
into
function AddMailQueue($flush = false, $to_array = array(), $subject = '', $message = '', $headers = '', $send_html = true, $priority = 3, $is_private = false)

In Subs-Post.php, all your emails will be html by default. Many people are actively against the usage of HTML emails, security and stuff, so it's your decision to make ;)
Honestly, I don't see anything wrong in it. Except that, for the message to look *really* great, you need to add some styling to it. Which SMF also doesn't do for you...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Illori

also some html emails automatically get considered spam and that can cause other issues.

DenDen60

Thanks Margarett.

I will try this and let you know how it works.

Illori, yes that is also true, but from my understanding of marketing, you have a higher response rate with HTML.

I might try both option and let you know how it turns out.


DenDen60


margarett

You are right, I'm sorry. The sendmail function is called everywhere with "false" in that argument, which overwrites the default "true" I changed :(

Find
// Send off an email.
function sendmail($to, $subject, $message, $from = null, $message_id = null, $send_html = false, $priority = 3, $hotmail_fix = null, $is_private = false)
{

Add after
$send_html = true;

Find
function AddMailQueue($flush = false, $to_array = array(), $subject = '', $message = '', $headers = '', $send_html = false, $priority = 3, $is_private = false)
{

Add after
[code] $send_html = true;

[/code]
Do note that I put the "false" again in the function declaration ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

DenDen60

Unless I am mistaken, this is exactly what you had done.

Each fist line contained a False and each second line contained a True

This is what I did, I changed two False to two True.

Am I missing something?

margarett

You are :P

In the first instructions I gave you, you should replace false with true in the function declaration. This means that, if no $send_html parameter is given when the function is actually called, we will consider true.

The second ones define the variable as true after declaration (eg, in actual execution). This means that, no matter how the function is called, the variable will be true

;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

DenDen60


DenDen60

Ok this is what I have actually:

function sendmail($to, $subject, $message, $from = null, $message_id = null, $send_html = true, $priority = 3, $hotmail_fix = null, $is_private = false)


function AddMailQueue($flush = false, $to_array = array(), $subject = '', $message = '', $headers = '', $send_html = true, $priority = 3, $is_private = false)



Is this OK, then we need to change something" :-(

This is what I got:

QuoteHere is your <b>username</b> Claude Lemay and password 456KLK!@3. <a href="http://en.wikipedia.org/wiki/United_States_Secretary_of_State">XYZ</a>
Regards,
The Building Better Societies Together Team.

Do I need to include HTML / Head /Body somewhere?




margarett

No, you need to have this

function sendmail($to, $subject, $message, $from = null, $message_id = null, $send_html = false, $priority = 3, $hotmail_fix = null, $is_private = false)
{
$send_html = true;


function AddMailQueue($flush = false, $to_array = array(), $subject = '', $message = '', $headers = '', $send_html = false, $priority = 3, $is_private = false)
{
$send_html = true;
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

DenDen60

It worked. Ok. So you are adding at the end. I thought you were just changing the

$send_htmlWill this affect all emails sent by SMF?

Thanks again

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

DenDen60


DenDen60

Quote from: margarett on February 27, 2015, 10:37:36 AM
Except that, for the message to look *really* great, you need to add some styling to it. Which SMF also doesn't do for you...

I have succeeded in sending html test emails.  :D However, I want to be able to add a style sheet. Is this possible?

I have tried using this code:

'subject' => 'Welcome to {FORUMNAME}',
        'body' => 'To {REALNAME}
       
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
<!--
@import url("mm_marketing.css");
-->
</style>
</head>
<h1 class="h1">LOGIN INFORMATION</h1>
<p class="p"> To login just visit our <a href="http://bit.ly/CandS_USA">community of practice</a> the site, all you have to do is to follow this link and then type in your <strong>USERNAME</strong> and <strong>PASSWORD</strong>, which are the following:</p>
<ul>
  <li> username: {USERNAME} </li>
  <li>password {PASSWORD} </li>
</ul>
<p class="p">It is recommended that you change your password by going into your profile. Follow this <a href="http://bit.ly/CandS_USA">link</a> then and click on <strong>PROFILE</strong>, then <strong>ACCOUNT SETTINGS</strong>. While you are there, please share with us the name of your :
 
  - <strong>CITY</strong>  - <strong>COUNTRY</strong>, as well as your closest
  - <strong>METROPOLITAN AREA</strong>. </p>
</html>',

        ),

Advertisement: