помощ за особена mail system

Noxy

Registered
Почти всичко работи. Проблема е че текста на български който изпращам е ?????????????????????, а там дето е предмет(относно) си е както трябва.


SendToFriend.tpl
това е формата:
Код:
<script LANGUAGE="JavaScript">

</script>

<script src="ValConfig.js"></script>
<script src="ValMain.js"></script>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link href="Templates/news.css" rel="stylesheet" type="text/css">


</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">


<table border="0" cellpadding="3" style="border-collapse: collapse" bordercolor="#111111" width="300" id="AutoNumber1" height="225">
<tr>
<td width="97%" background="../../design/label.png" valign="top">
<sup>
                                    <font color="#4286C0" face="Arial Black"> 
                                    <span lang="en-us">
                                    .:</span></font><font color="#FFFFFF" face="Verdana" size="2"><b>Изпрати 
на преятел</b></font></sup></td>
</tr>
<tr>
<td width="97%" bgcolor="#F0F5F9">
<form action="Friend.php?Action=ProcessForm" onSubmit="return validateForm(this,bConfirm=true);" onFocusOut="clearStyle(event.srcElement)" method="POST" enctype="multipart/form-data">
<font face="Verdana">
<font color="#111111"><b><font size="1">Вашето име:</font></b></font><font size="1"><font color="#111111"><br>
<input type="text" size="33" name="UserName" alt="blank"><bR><BR>

<b>Име на получателя:</b><br>
<input type="text" size="33" name="SendToName" alt="blank"><bR><BR>

<b>Е-<span lang="en-us">mail</span> на палучателя:</b></font><br>
<input type="text" size="33" name="SendToEmail" alt="email"><bR><BR>
<input type="hidden" name="newsid" value="$NewsID">
<input type="submit" value="Изпрати">
</font></font>
</form>
</td>
</tr>
</table>

SendToFriendMail.tpl
това е текста който се изпраща:
Код:
Здравеи {SendToName}, {YourName} помисли че тази статя от портфолиото на {SiteName}. {SiteUrl}/portfolio.php?Action=Full&NewsID={NewsID}#{NewsID} {SiteUrl}


Това е скрипта:
Код:
<?php
// Start PHP
      // Leave this code at the very top.
      // This is so that if a news id is not specified user will be redirected back to the main news page.
      $NewsID = (isset($_GET['NewsID']) ? $_GET['NewsID'] : 'None');
      $Action = (isset($_GET['Action']) ? $_GET['Action'] : 'Show');
      $Template = (isset($_GET['Template']) ? $_GET['Template'] : 'Default');
      $Lang = (isset($_GET['Lang']) ? $_GET['Lang'] : 'en');
      if ($Action == "ShowNews")
      {
            if ($NewsID == "None")
            {
                  header("Location: index.php");
                  exit;      
            }
      }
      
      // Get Absolute path
      $basedir = dirname(__file__);
      //$e = explode("Classes",$basedir);
      $abpath = $basedir . "/";
      // End Absolute Path
      
      // Do Includes
      include $abpath . "Config/mysql.php";
      include $abpath . "Lang/" . $Lang . ".php";
      include $abpath . "Classes/news.class.php";
      // End Includes
      
      // Do mysql Connection
      $dbl = @mysql_connect($hn,$un,$pw)    // Connect to mysql dbase
      or die ("
                  <html><head>
                  <title>K2News Management | Administration Control Panel</title>
                  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">
                  <link href=\"Templates/template.css\" rel=\"stylesheet\" type=\"text/css\">
                  
                  </head>

                  <body bgcolor=\"#e4eaed\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">
                  <Br><BR><BR>
                  <table width=\"40%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"415263\" align=center valign=middle>
                  <tr>
                  <td class=\"formtop\">
                  <font color=\"FFFFFF\">Mysql Error</font>
                  </td>
                  </tr>
                  <tr>
                  <td valign=\"top\">
                  <table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" bgcolor=\"FFFFFF\">
                  <tr> 
                  <td class=\"row1\"><b><img src='Images/error.gif' border=0></b>  <font color=red><b>There has been an error connecting to the mySQL database.  Please check your mysql.php file and make sure all the details are correct.</font></b><br></td>
                  </tr>
                  </table>
                  </td>
                  </tr>
                  </table>
      
                  </body>
                  ");
      mysql_select_db($db);
      // End connection
      
      // get settings
            $sqlab = mysql_query("SELECT * FROM " . $tprefix . "settings");
            if ($sqlab)
            {
                  while($row = mysql_fetch_array($sqlab))
                  {
                        $$row['setname'] = $row['setvalue'];
                  }
            }
            // end settings

      // FUNCTIONS
      
            /////////////////////////////////////////////////////////////////////
            // Function: GetTemplate
            // Description: Get the template and returns it's contents
            function GetTemplateC($whattemp,$Template,$abpath,$newsid=NULL)
            {
            // Start Sub Function
                  $thetemp = ""; 
                        
                  // Check if the template exists            
                  // Grab the template specified
                  if (!is_dir($abpath . "Templates/" . $Template))
                  {            
                        //starting directory
                          $startDir = $abpath . "Templates";
                          //open directory
                          // Silently to error Trap - TSL
                          if ($openDir = @opendir($startDir))
                          {
                                 while($path = readdir($openDir))
                                 {
                                          //gets the base name of file i.e instead of /home/canivour/html/index.html its index.html
                                          $file = basename($path);
                                          //makes sure we dont we read the . and .. direcotry (current directory and parent directory)
                                          if($file!="." && $file!="..")
                                          { 
                                                 //if its not a directory print out the stats (can be changed for your needs)
                                                 if(is_dir($startDir."/".$file))
                                                 {
                                                        $fullDir = $startDir."/".$file; //full directory path of file
                                                        $statCheck = stat($fullDir); //keeps info on file
                                                        $Dir = $file;
                                                 }  
                                        } 
                                       }
                         }
                         // End search for new template set
                         
                        echo "<Br><font color=red><b>Error,</b> Could Not Find: \"<i>Templates/" . $Template . "/" . $whattemp . "\"</i>.<br>";
                        $Template = $Dir;
                        echo "Using: \"<i>Templates/" . $Template . "/" . $whattemp . "\"</i> Instead.</font><br>";
                              
                  }
                  $file = @fopen($abpath . "Templates/" . $Template . "/" . $whattemp, "r")
                        or die("<Br><font color=red><b>Error,</b> Failed to Open: \"<i>Templates/" . $Template . "/" . $whattemp . "\"</i>.<br>");
                  $thetemp .= @fread($file, 200000); 
                  @fclose($file);
                  // Send back the template
                  $NewsID = $newsid;
                  $thetemp = addslashes($thetemp); 
                  eval("\$thetemp = \"$thetemp\";");
                  $thetemp = stripslashes($thetemp); 
                  
                  return $thetemp;
            // End Sub Function
            }
            
            // Do Header
            echo GetTemplateC("Header.tpl",$Template,$abpath); 
            // End Header

if ($Action == "ProcessForm")
{
      $name = $_POST['SendToName'];
      $semail = $_POST['SendToEmail'];
      $name2 = $_POST['UserName'];
      $nid = $_POST['newsid'];
      
      $lettertemp = GetTemplateC("SendToFriendMail.tpl",$Template,$abpath,$lettertemp);
      $lettertemp = str_replace("{NewsID}",$nid,$lettertemp);
      $lettertemp = str_replace("{SendToName}",$name,$lettertemp);
      $lettertemp = str_replace("{SendToEmail}",$semail,$lettertemp);
      $lettertemp = str_replace("{YourName}",$name2,$lettertemp);
      $lettertemp = str_replace("{SiteUrl}",$mainsite,$lettertemp);
      $lettertemp = str_replace("{SiteName}",$sitename,$lettertemp);
      mail($semail, $name2 . " мисли, че може да харесате това", $lettertemp, "From: <" . $contact . ">\n". "Reply-To: <" . $contact . ">\n");
      echo "<body onload=\"javascript:window.close();\">";
}
elseif ($Action == "Show")
{
      echo GetTemplateC("SendToFriend.tpl",$Template,$abpath,$NewsID); 
}

            // Do Footer
            echo GetTemplateC("Footer.tpl",$Template,$abpath); 
            // End Footer
 
Добави някой друг ред.

Примерно след този ред :
$lettertemp = str_replace("{SiteName}",$sitename,$lettertemp);

добави следните редове:
$headeri = 'MIME-Version: 1.0' . "\r\n";
$headeri .= 'Content-type: text/html; charset=windows-1251' . "\r\n";

после

mail($semail, $name2 . " мисли, че може да харесате това", $lettertemp, "From: <" . $contact . ">\n". "Reply-To: <" . $contact . ">\n");

го направи така:
mail($semail, $name2 . " мисли, че може да харесате това", $lettertemp, $headeri."From: <" . $contact . ">\n". "Reply-To: <" . $contact . ">\n");

Изхождам от това, че преди "From:
трябва да има header-и .

Просто пробвай и ако нещо не стане кажи.

В момента не изпращаш header-и и пощата отсреща
незнае, че ще и пращаш булгаристански букви.
 
стана но, адреса
http://bds.div-impex.com/portfolio.php?Action=Full&NewsID=16#16

вече не се изписва като линк , а кото текст. Как може д се корегира това ?
 
Това
Здравеи {SendToName}, {YourName} помисли че тази статя от портфолиото на {SiteName}. {SiteUrl}/portfolio.php?Action=Full&NewsID={NewsID}#{NewsID} {SiteUrl}


го промени на
Здравеи {SendToName}, {YourName} помисли че тази статя от портфолиото на {SiteName}.
<а href={SiteUrl}/portfolio.php?Action=Full&NewsID={NewsID}#{NewsID} >{SiteUrl}</a>
 
http://www.web-tourist.net/forum/viewtopic.php?t=1015

<?php
$to = 'webmatrix@mail.bg';
$subject = $_POST["subject"];
$message = $_POST["message"];
$headers = 'From: '.$_POST["e-mail"];

if(mail($to, $subject, $message, $headers))
echo "Съобщението беше изпратено.";
?>

има същия проблем как да го накарам де ни изписва ???? а да си е на български

Код:
<?php
$to = 'webmatrix@mail.bg';
$subject = $_POST["subject"];
$message = $_POST["message"];
$headers = 'From: '.$_POST["e-mail"];
$headeri = 'MIME-Version: 1.0' . "\r\n";
$headeri .= 'Content-type: text/html; charset=windows-1251' . "\r\n";
if(mail($to, $subject, $message, $headeri))
echo "Съобщението беше изпратено.";
?>

така става ама $headers = 'From: '.$_POST["e-mail"]; трябва де са направи тача че да бачка, защото не ми изписва от кой е mail-a...



a това какво е ?
Код:
Warning: mail(): SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE. in /www/div-impex.com/bds/root/mail.php on line 14
 
Код:
<?php
$to = 'webmatrix@mail.bg';
$subject = $_POST["subject"];
$message = $_POST["message"];
$ot=$_POST["e-mail"];
$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=windows-1251' . "\r\n"; 
$headers .='From:'.$to.'' . "\r\n" . 
'Reply-To:'.$to.'' . "\r\n" . 
'X-Mailer: PHP/' . phpversion(); 


if(mail($to, $subject, $message, $headers))
echo "Съобщението беше изпратено.";
?>
 

Back
Горе