Webdate emails showing in raw HTML code solution

Have A Bug With Your Webdate Script. Ask For Help Here.

Webdate emails showing in raw HTML code solution

Postby paul on Thu Apr 24, 2008 11:20 pm

Ok there have been a few site owners who had the site emails showing up in RAW HTML code

which looks very messy to the recipient...

I recently found the solution and hope it works for you site owners having this email problem with webdate.

post to this thread if this helps you out.

open the file:

smartway/lib/mail.lib

find the following headers near the bottom:

Code: Select all
$headers = "From: $sFrom\r\n".
                 "Reply-To: $sFrom\n".
                 "X-Mailer: $site_title\r\n";
   if ($send_html_emails)
   {
      $headers .= "MIME-Version: 1.0\r\n";
      $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
   }


change those lines to look like the following:

Code: Select all
$headers = "From: $sFrom\n".
                 "Reply-To: $sFrom\n".
                 "X-Mailer: $site_title\n";
   if ($send_html_emails)
   {
      $headers .= "MIME-Version: 1.0\n";
      $headers .= "Content-Type: text/html; charset=ISO-8859-1\n";
   }


this is the same code with the \r removed

this should get the html emails to display properly let me know how it works for you.

Paul
User avatar
paul
Site Admin
 
Posts: 264
Joined: Sat Jan 26, 2008 7:30 pm
Location: Newington,Ct,USA

Re: Webdate emails showing in raw HTML code solution

Postby ischylar on Wed May 07, 2008 7:55 pm

HI Paul, I contacted you about this problem sometime ago. I am happy to hear that you have found a solution... I am not able to locate the file smartway/lib/maail.lib.. i have looked in the page templates and everything. Please tell me where I can find this file so that I can correct it.

Best Regards
Nina Lowman
ischylar
 
Posts: 19
Joined: Tue Feb 05, 2008 1:52 pm

Re: Webdate emails showing in raw HTML code solution

Postby paul on Thu May 08, 2008 8:49 pm

This file is not found in page templates

it is in the root directory/smartway/lib/mail.lib

you need to ftp into your site or use a file manager through plesk/ or cpanel to access the file

I will change yours up now....

Paul
User avatar
paul
Site Admin
 
Posts: 264
Joined: Sat Jan 26, 2008 7:30 pm
Location: Newington,Ct,USA

Re: Webdate emails showing in raw HTML code solution

Postby ischylar on Sun May 11, 2008 1:38 pm

Hi Paul,

Thanks for fixing it. It definitely seems to be working properly now....THANK YOU!!!!!
Once again your a life saver
ischylar
 
Posts: 19
Joined: Tue Feb 05, 2008 1:52 pm

Re: Webdate emails showing in raw HTML code solution

Postby QQQ on Mon Jun 02, 2008 10:21 am

webdate 2 has the same problem, is that for webdate 2 ? and what is the meaning for "/r" ?
QQQ
 
Posts: 14
Joined: Mon Jun 02, 2008 10:20 am

Re: Webdate emails showing in raw HTML code solution

Postby paul on Tue Jun 03, 2008 12:12 pm

Send me ftp access and url of your site and I will look into the mail function for 2.0

Paul
User avatar
paul
Site Admin
 
Posts: 264
Joined: Sat Jan 26, 2008 7:30 pm
Location: Newington,Ct,USA

Re: Webdate emails showing in raw HTML code solution

Postby QQQ on Tue Jun 03, 2008 12:55 pm

can I just send you the original files ?
QQQ
 
Posts: 14
Joined: Mon Jun 02, 2008 10:20 am

Re: Webdate emails showing in raw HTML code solution

Postby paul on Tue Jun 03, 2008 5:50 pm

Replace your existing file

smartway/lib/mail.lib

overwrite the existing file mail.lib with this:

Code: Select all
<?
     function mailSend($sEmail, $sTpl, $sFrom = "")
   {
       global $mail_template_dir, $admin_mail, $send_html_emails, $root_host, $site_title;

      if(!isset($sFrom) || $sFrom == "") $sFrom = $admin_mail;

      if(!file_exists($mail_template_dir.$sTpl))
      {
          return;
      }

      $site_url = $root_host;
      $handle = fopen($mail_template_dir.$sTpl, "r");
      if(!$handle)
      {
          return;
      }

      $sContent = fread($handle, filesize($mail_template_dir.$sTpl));
      fclose($handle);

      //   Defining subject

      $data = split("<-SUBJECT: ", $sContent);
                $data = split(" ->", $data[ 1 ]);

      $sSubject = $data[ 0 ];
      
      //   Parsing subject

      $subject = $sSubject;

      for($ptr = 0; $ptr < strlen($subject); $ptr++)
      {
          switch($subject[ $ptr ])
         {
             case "{":
               $is_token = 1;
               $token = "";
               break;
            case "}";
               $is_token = 0;

               eval("global \$".strtolower($token).";");
               eval("\$sVal = \$".strtolower($token).";");

               $sSubject = str_replace("{{$token}}", "$sVal", $sSubject);

               $token = "";
               break;
         }

          if(($subject[ $ptr ] != "{" && $subject[ $ptr ] != "}") && $is_token)
         {
             $token .= $subject[ $ptr ];
         }
      }
      
      $sBody = $data[ 1 ];

      //   Parsing body

      $body = $sBody;

      for($ptr = 0; $ptr < strlen($body); $ptr++)
      {
          switch($body[ $ptr ])
         {
             case "{":
               $is_token = 1;
               $token = "";
               break;
            case "}";
               $is_token = 0;

               eval("global \$".strtolower($token).";");
               eval("\$sVal = \$".strtolower($token).";");

               $sBody = str_replace("{{$token}}", "$sVal", $sBody);

               $token = "";
               break;
         }

          if(($body[ $ptr ] != "{" && $body[ $ptr ] != "}") && $is_token)
         {
             $token .= $body[ $ptr ];
         }
      }

      $headers = "From: $sFrom\n".
                 "Reply-To: $sFrom\n".
                 "X-Mailer: $site_title\n";
   if ($send_html_emails)
   {
      $headers .= "MIME-Version: 1.0\n";
      $headers .= "Content-Type: text/html; charset=ISO-8859-1\n";
   }

        if(isset($sEmail)) @mail($sEmail, $sSubject, $sBody, $headers);
   }
?>


it looks almost identical to 3.0 not sure so I posted it anyway this is for 2.0

Paul
User avatar
paul
Site Admin
 
Posts: 264
Joined: Sat Jan 26, 2008 7:30 pm
Location: Newington,Ct,USA


Return to Have A Bug? Ask For Help Here

Who is online

Users browsing this forum: No registered users and 5 guests

cron