Hi all:

I use php to send a html email with javascript. I test it in my outlook. It works fine. But When i test in hotmail.com and yahoo.com. The html email works find but the javascripts doesn't work. Yahoo simply convert my javascript code into text in html email. Is there any way to make javascript works in yahoo and hotmail mail ?

Please Please HELP ME!! This is urgent

Ray

    Perhaps i didnt specific my question clearly. I sent an html email to yahoo. My html email includes part of my popout javascript. The html party works godo but the javascript got convert to plain text. Anyone has ideas?

    Ray

      You seem to want a reply, so even though I have little constructive to say, here I am.

      I would assume that hotmail and yahoo are converting your javascript to html as a security precaution. And a good one in my opinion. As soon as I read your question I immediately checked thunderbird to ensure that javascript is disabled in my email. (Of course it was already.)

      I for one don't want my email to contain any sort of programming. There may be a way around hotmail and yahoo's safeguards, but if there is, I hope no one ever finds it. No offense intended.

        Thanks for your suggestions....I know this is a secuirty issue and i dont' intend to hack people's privacy.

          If anyone is interested, here is my code:

          <?php
          //session_start();
          require_once("db_cns.php");
          require_once("htmlMimeMail5/htmlMimeMail5/htmlMimeMail5.php");

          $text2 = "
          <html>
          <head>
          <title>Untitled</title>
          <script language=\"JavaScript\" type=\"text/javascript\">

          window.onload = function () {

          	var today = new Date();
          	var expire = new Date();
          	var cookieValue=\"1\";
          	var name =\"view1\";
          	var cookieFound = 0;
              var start = 0;
              var end = 0;
              var CookieString = document.cookie;
          
          	var myvar;
              var i =0;
              while (i <= CookieString.length) {
                      start = i;
                      end = start + name.length;
                      if (CookieString.substring(start,end) == name) {
                              cookieFound = true;
                              break;
                      }
                      i++;
              }
          
          	if (cookieFound==false) {
          			expire.setTime(today.getTime() + 3600000*24*1);
          
          			document.directForm.submit();
          	}

          }
          </script>

          </head>
          <body >

          HTML
          <FORM
          NAME=\"directForm\"
          ACTION=\"http://localhost/email/email/test.php\"
          METHOD=\"get\"
          ENCTYPE=\"multipart/form-data\">
          <input type=\"hidden\" name=\"cid\" value=\"1000\">
          </form>
          </body>
          </html>

          ";

          // Instantiate a new HTML Mime Mail object
          $mail = new htmlMimeMail5();

          // Set the sender address
          
           $mail->setFrom("email");
          // Set the reply-to address
          $mail->setReturnPath("email");
          
          // Set the mail subject
          $mail->setSubject("Test HTML Mime Mail");
          
          // Set the mail body text

          $mail->setText("HELL0");

           // Create the HTML email
          $mail->setHTML($text2);
          
          
          // Send the email!

          $mail->send(array("email"));

            Any prudent modern email client displays its HTML will Javascript disabled or stripped by default. Many don't even have an option to turn it on.

            Historically there have been too many problems. Javascript is disabled by default in

            • Outlook
            • Outlook Express
            • Mozilla mail

            Javascript may be stripped entirely in

            • Hotmail
            • Gmail
            • other web mails

            There is nothing you can do about this. It is a client user preference which is not negotiable. Most users are not even aware that it can be turned on.

            Historically a number of worms and other nasties have been spread by email Javascript.

            So just don't use it - it won't work.

            Equally, forget ActiveX, Java or other plugins in email messages.

            Mark

              Write a Reply...