Merhaba, Ziyaretçi. Lütfen giriş yapın veya üye olun.
Aktivasyon mailiniz gelmediyse buraya tıklayın.
Mayıs 12, 2008, 06:33:37 pm
41799 Mesaj 9073 Konu Gönderen: 17469 Üye
Son üye: blueboy21
Turk-Php.Com Forum  |  Yardım Forumları  |  Uygulama Yükleme, Kurulum ve Ayarları  |  html format mail almak « önceki sonraki »
Sayfa: [1] Yazdır
Yazan Konu: html format mail almak  (Okunma Sayısı 549 defa)
orxanx
Yeni Kullanıcılar
*
Offline Offline

Mesaj Sayısı: 9


Üyelik Bilgileri
html format mail almak
« : Haziran 18, 2006, 06:32:34 am »

Mrb arkadaslar! benim phpforms scriptle yaptigim bi forum var, ama bu forumdan gelen bilgiler mail-e sadece text formatinda gonderiliyor, benim isteyim gelen bilgileri html formatinda almak.. scripte bi goz attigmda iki koddan subhelendim.. ama tam olarak sonuca ulasamadim.. simdi bu kodlari sizlere gonderiyorum, lutfen bi goz atin..

Kod:
<?php


    
//----------------------------------------------------//
    // Safe input/output ()                               //
    //----------------------------------------------------//
    Function TxtSafeInput$sVal )
    {
       $aHtml = array('textarea''script''table''select''optgroup');
       $sVal preg_replace "/<(br)>/ies"    "&lt;\\1&gt;"$sVal );
       foreach ($aHtml as $sTag)
       {
          $sVal preg_replace"/<(\s*{$sTag})/is""&lt;\\1"$sVal );
       }

       $sVal str_replace  '/'            "&#047;"         $sVal );
       $sVal str_replace  "\n"           "<br>"           $sVal );
       return $sVal;
    }
    Function TxtSafeOutput$sVal )
    {
       $sVal str_replace  "<br>"      "\n"       $sVal );
//       $sVal = str_replace  ( "&"         , "&amp;"    , $sVal );
       $sVal str_replace  "<"         "&lt;"     $sVal );
       $sVal str_replace  ">"         "&gt;"     $sVal );
       $sVal str_replace  "\""        "&quot;"   $sVal );
       return $sVal;
    }

    // to write into html-code textarea
    Function TxtGenOutput$sVal )
    {
       $sVal str_replace  "<"         "&lt;"     $sVal );
       $sVal str_replace  ">"         "&gt;"     $sVal );
       $sVal str_replace  "\""        "&quot;"   $sVal );
       return $sVal;
    }
    Function TxtUnSafeOutput$sVal )
    {
       $sVal str_replace  "<br>"         "\n"       $sVal );
       //---
       $sVal str_replace  "&gt;"         ">"        $sVal );
       $sVal str_replace  "&lt;"         "<"        $sVal );
       $sVal str_replace  "&#33;"        "!"        $sVal );
       $sVal str_replace  "&#124;"       "|"        $sVal );
       $sVal str_replace  "&#39;"        "'"        $sVal );
       $sVal str_replace  "&quot;"       "\""       $sVal );
       $sVal str_replace  "--&#62;"      "-->"      $sVal );
       $sVal str_replace  "&#60;&#33;--" "<!--"     $sVal );
       $sVal str_replace  "&amp;"        "&"        $sVal );
       $sVal str_replace  "&#047;"       '/'        $sVal );
       $sVal str_replace  "&#60;"        '<'        $sVal );

       return $sVal;
    }

    // TO-DO: remove in more stable version
    // TEMP: A little patch for
    // \', \" and  \\ problem
    //
    function _FixEmailMsgBug$sText )
    {
       $sText str_replace'\\&#39;',   "'",     $sText );
       $sText str_replace'\\&quot;',  '"',     $sText );
       $sText str_replace'&#124;',     '|',     $sText );
       $sText str_replace'\\\\',      '\\',    $sText );
       $sText str_replace'&amp;',     '&',     $sText );

       return $sText;
    }



    //----------------------------------------------------//
    // Decodes and encodes special chars in given string  //
    //----------------------------------------------------//
    Function DecodeString($sStr)
    {
        $sStr preg_replace("/!/","&#33;",$sStr);
        $sStr preg_replace("/'/","&#39;",$sStr);
        $sStr preg_replace('/"/',"&#34;",$sStr);
        $sStr preg_replace("/</","&#60;",$sStr);
        $sStr preg_replace("/>/","&#62;",$sStr);
        return $sStr;
    }

    Function EncodeString($sStr)
    {
        $sStr preg_replace("/&#33;/","!",$sStr);
        $sStr preg_replace("/&#39;/","'",$sStr);
        $sStr preg_replace("/&#34;/",'"',$sStr);
        $sStr preg_replace("/&#60;/","<",$sStr);
        $sStr preg_replace("/&#62;/",">",$sStr);
        return $sStr;
    }


    //----------------------------------------------------//
    // Validate email format                              //
    //----------------------------------------------------//
    Function CleanEmail($sEmail "")
    {
        static $_mReturn;

        $sEmail preg_replace"#[\n\r\*\'\"<>&\%\!\(\)\{\}\[\]\?\\/]#",
                                "",
                                $sEmail
                              
);

        if ( preg_match"/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/",
                         $sEmail)
                       )
        {
            $_mReturn $sEmail;
        }
        else
        {
            $_mReturn FALSE;
        }

        return $_mReturn;
    }

?>


en cok subhelendigm bolum su

Kod:

<?php

    
// E-mail format checking function
 
   function isCorrectEmail$sEmailString )
 
   {
 
      $bResult 0;
 
      $sPat "/^[a-z0-9_\.\-]+@([a-z0-9][a-z0-9-]+\.)+[a-z]{2,4}$/i";

 
      if ( preg_match$sPat$sEmailString ) ) $bResult 1;
 
      else $bResult 0;

 
      return $bResult;
 
   }

 
   // Replaces \n with \r\n
 
   function doCorrectMtpl$sMtpl )
 
   {
 
      $sResult '';
 
      $sResult str_replace"\n""\r\n"$sMtpl );
 
      return $sResult;
 
   }

 

 
   function xmail$email_address$email_cc$email_bcc$email_from,
 
                   $subject$msg$attach_filepath$attach_types,
 
                   $want_attach$attach_realname )
 
   {
 
      $b 0;
 
      $mail_attached "";
 
      $boundary "000XMAIL000";
 
      if (count($attach_filepath)>&& $want_attach)
 
      {
 
         for ($a=0;$a<count($attach_filepath);$a++)
 
         {
 
            if ($fp=fopen($attach_filepath[$a],"rb"))
 
            {
 
               $file_name   basename$attach_filepath[$a] );
 
               $content[$b] = fread$fpfilesize($attach_filepath[$a]) );
//              $mail_attached.="--".$boundary."\n"."Content-Type: $attach_types[$a]; name=\"$file_name\"\n"."Content-Transfer-Encoding: base64\n"."Content-Disposition: inline; filename=\"$file_name\"\n\n".chunk_split(base64_encode($content[$b]))."\n";
 
               $mail_attached .="--".$boundary."\n"."Content-Type: $attach_types[$a]; name=\"$file_name\"\n"."Content-Transfer-Encoding: base64\n"."Content-Disposition: inline; filename=\"$attach_realname[$a]\"\n\n".chunk_split(base64_encode($content[$b]))."\n";
 
               $b++;
 
               fclose($fp);
 
            }
 
            else
 
            {
 
               echo "Can't send an attachment.";
 
            }
 
         }
 
         $mail_attached .= "\n";
//        $mail_attached .= "--".$boundary."\n";
 
         $add_header ="MIME-Version: 1.0\n"."Content-Type: multipart/mixed; boundary=\"$boundary\"; Message-ID: <".md5($email_from)."@domain.net>";
 
         $mail_content="--".$boundary."\n"."Content-Type: text/html; charset=\"iso-8859-1\"\n"."Content-Transfer-Encoding: 8bit\n\n".$msg."\n\n".$mail_attached;
 
         return mail$email_address,$subject,$mail_content,"From: ".$email_from."\nCC: ".$email_cc."\nBCC: ".$email_bcc."\nErrors-To: ".$email_from."\n".$add_header );
 
      }
 
      else
 
      {
 
         return mail$email_address,$subject,$msg,"From: "$email_from"\nErrors-To: ".$email_from );
 
      }
 
   }

 
?>

Logged
plazma
Yeni Kullanıcılar
*
Offline Offline

Mesaj Sayısı: 16


Üyelik Bilgileri
Ynt: html format mail almak
« Yanıtla #1 : Kasım 19, 2007, 07:28:30 am »

text area ile zaten baslio html yeer donusmez bu print die acar sin istsersen deferleri girersin kisimlar anca oyle olur belki
Logged

Kod:
u have never seen before...
Sayfa: [1] Yazdır 
« önceki sonraki »
Gitmek istediğiniz yer: