Announcement

Collapse
No announcement yet.

How to pass HTML related signs in an e-mail text?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to pass HTML related signs in an e-mail text?

    Hi,

    In HTML I have a problem with a variable value '2 - Puppy class 6-<9 months'.
    This line of the message for the e-mail stops before the '<' sign.

    Several ways for applications using HTML, as found at the web, fail.
    I had to remove the important '<' value from the field values.

    For a MySQL database a disturbing comma in a field value can be preceded by a backslash.
    Databases have all their own ways to manage such problems.

    It seems to me that ScriptCase must have a way to handle.
    Maybe it's for a specialist. Please add your opinion.

    Regards
    Jan Willem
    Last edited by JWST; 06-07-2014, 06:16 AM.

  • #2
    For " charachter works with \ char! I didnt tried your sample, but maybe \< should work.

    Try to use htmlspecialchars or addslashes php function to your string
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      HTML related characters are passed correctly with function htmlspecialchars()

      Thanks for the hint. The function htmlspecialchars() works fine.
      Actually, in my previous tests the ';' character in "&lt;" missed.

      $ClassNo = {ClassNo};
      $sql = "SELECT ClassName FROM ClassesPortalLog WHERE ((ClassLanguage = '[Language]') AND (ClassNo = {ClassNo}))";
      sc_lookup(cn, $sql, "conn_mysql2");
      if (isset({cn[0][0]}))
      {
      $ClassNoLimited = $ClassNo . " - " . str_replace("<", "&lt;", {cn[0][0]});
      $ClassNo .= " - " . htmlspecialchars({cn[0][0]});

      }

      Part of the mail message:
      $mail_message .= {lang_EntriesPortalLog_fld_ClassNo} . " = " . $ClassNoLimited . "<br>";
      $mail_message .= {lang_EntriesPortalLog_fld_ClassNo} . " = " . $ClassNo . "<br>";

      Output in Dutch:
      Klasse nummer = 4 - Tussenklas 15-<24 mnd.
      Klasse nummer = 4 - Tussenklas 15-<24 mnd.

      Regards

      Jan Willem

      Comment


      • #4
        It's suppose should work for "<" too.
        http://docs.php.net/manual/en/functi...ecialchars.php

        '<' (less than) becomes '&lt;'
        /Giuseppe

        Professional Scriptcase Services
        Some Customers opinions

        Comment


        • #5
          The problem is solved. The line $ClassNoLimited demonstrates the replace function for only value "&lt;". However in received mail about the thread it gets translated to <.

          Comment

          Working...
          X