No announcement yet.

Using tinymce to format mail message / broken after v8.1.008 update

  • Filter
  • Time
  • Show
Clear All
new posts

  • Using tinymce to format mail message / broken after v8.1.008 update

    Using the OnAfterInsert event in sec_form_add_users I am sending an email to the new user.

    I did not want to use "application language" because I want administrators to be able to change the content of the message sent (similar to canned messages in sc_tickets). In sc_tickets it uses html in a field. I didn't like that because I didn't want the end user to have to type html to create the canned message.

    So I used the html editor (tinymce) to created those canned messages .. and it worked great.

    This is the code that I was using to get that:
    //Get the mail message
    sc_lookup(rs, "SELECT outbound_message FROM smtp_message WHERE function_name='send_mail_to_new_user' ");
    $newuser_msg = {rs[0][0]};

    And this to include the message in the email:
    $mail_message = sprintf($newuser_msg);

    After updating to v8.1.008 (or maybe it was broken in v8.1.007 and I just did not notice) it no longer works. The error message that I get is this:
    Fatal error: Call to undefined function SC_Mail_Image() in ...sec_form_add_users_apl.php on line 4310

    Looking at line 4310 in sec_form_add_users_apl I see the sc_mail_image but have no idea where that function is supposed to be - because it is not a function that I created.

    So there's my problem.

    I'm wondering if anyone else has done the same thing - using canned messages in the email message - and if so would you be willing to share your code? I'm new to this and not sure that I did it right in the first place!

    I did look at sc_tickets and see they are using a function "GetTemplateEmailstaff" but that function is not in php methods for any of the applications that use it (which has just caused more confusion! Where is that function???)
    Last edited by betty; 09-18-2015, 04:57 AM. Reason: Solved

  • #2
    My application "sec_form_add_users" did not have a problem; the issue was in the other application where I store my canned messages. I had to turn on "Use a template from the HTML Editor" in form settings and then recompile that application. (Although I had previously recompiled everything - I did not have that new option turned on because I did not know / comprehend that it was there).

    This was the result of a change in v8.1.006 where tinymce was modified to enable layout options (see Layout > HTML Editor Templates).

    (I still have not found the "GetTemplateEmailStaff" function in sc_tickets .. but oh well .. moving on)