Activation Email custimization with html

Started by miroslavlav, November 27, 2015, 06:21:20 AM

Previous topic - Next topic

miroslavlav

Hi All,

can you tell me is it possible to customize activation email, so i could include html tags into it (eg. tables, images, h2...)


thanks

margarett

SMF by default sends emails in plaintext, although it is prepared to build them in HTML too.

http://www.simplemachines.org/community/index.php?topic=539771.0
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

miroslavlav

Hi Margarett,

thanks for the quick reply, but it's not working  :(

I changed in Register.php from
sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 0); to
sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, null, true, 0);

then changed in EmailTemplates.english.php body of the mail

also cleared the cache in forum maintenance just for case, but it still shows html tags as plain text

do you know why is this happening

thanks

margarett

Which is the email you're trying to customize and which of the email templates are you changing?
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

miroslavlav

I'm trying to customize template from EmailTemplates.english.php in register_activate section

is this where I should change it?

Jade Elizabeth

I'm interested in doing this too, so don't mind me I'm just here to see how it goes :D.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

margarett

Quote from: miroslavlav on November 30, 2015, 02:33:41 AM
I'm trying to customize template from EmailTemplates.english.php
Which of the templates inside? register_activate? ;)

Just to be sure, you want to customize the email that one receives after registration, when administrator enforces email activation, is that it?
edit: if that is the case, the call to sendmail in Register.php is the wrong one, that's used to resend the password change link. The call to sendmail in the registration stage is in Subs-Members.php, function registerMember
// Need to activate their account - or fall under COPPA.
elseif ($regOptions['require'] == 'activation' || $regOptions['require'] == 'coppa')
{
$replacements = array(
'REALNAME' => $regOptions['register_vars']['real_name'],
'USERNAME' => $regOptions['username'],
'PASSWORD' => $regOptions['password'],
'FORGOTPASSWORDLINK' => $scripturl . '?action=reminder',
'OPENID' => !empty($regOptions['openid']) ? $regOptions['openid'] : '',
);

if ($regOptions['require'] == 'activation')
$replacements += array(
'ACTIVATIONLINK' => $scripturl . '?action=activate;u=' . $memberID . ';code=' . $validation_code,
'ACTIVATIONLINKWITHOUTCODE' => $scripturl . '?action=activate;u=' . $memberID,
'ACTIVATIONCODE' => $validation_code,
);
else
$replacements += array(
'COPPALINK' => $scripturl . '?action=coppa;u=' . $memberID,
);

$emaildata = loadEmailTemplate('register_' . ($regOptions['auth_method'] == 'openid' ? 'openid_' : '') . ($regOptions['require'] == 'activation' ? 'activate' : 'coppa'), $replacements);

sendmail($regOptions['email'], $emaildata['subject'], $emaildata['body'], null, null, false, 0);

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

miroslavlav

Thanks a lot Margarett, that did the trick :)

and sorry if I sounded funny with register_activate thing, but you got the point :)

anyway, thanks again for great and quick responses  :)

Jade Elizabeth

Is there an easier way to do this? Perhaps by calling a function from another template that will automatically add a header and footer around the messages that we can just paste in there? :)
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Advertisement: