Arkadaşlar server php 5.3.6 versyon, mail gönderiyorum fakat mail html olarak düşüyor html gözükmekte.
<?php require('library.php');
include('../../common/SMTPconfig.php');
include('../../common/SMTPClass.php');
error_reporting(0) ;
$object = new IG_Class();
$site_url = $object->cond_select('ig_configuration','site_url','site_id=1');
$action = @$_REQUEST['action'];
$view = $action;
$redirect_page = 0;
$redirect_url = '';
#### Page navigation
$table = 'ig_users';
$condition = 'email_subscribe = 1 AND user_status=1';
$page_result = '20';
include('../../common/page_nav.php');
#### Page navigation
switch($action)
{
case 'send':
$from = $_REQUEST['from'];
$city = $_REQUEST['city'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];
$site_name = $object->cond_select('ig_configuration','site_name','site_id=1');
$SQL_query = mkr_select("ig_newsletter",'*','city_id='.$city);
while($fetch_res = fetch_array($SQL_query))
{
$cont="<p><h3>Merhaba, $fetch_res[email_id],</h3></p>
<p> $message</p>";
/* $mailheader="From:".$from." \r\n";
$mailheader=$mailheader."Reply-to:".$from." \r\n";
$mailheader=$mailheader."MIME-Version: 1.0 \r\n";
$mailheader=$mailheader."Content-Type: text/HTML; charset=ISO-8859-1 \r\n";
$mailheader=$mailheader."X-mailer: PHP/".phpversion(); */
//mail($fetch_res['email_id'],$subject,$cont,$mailheader);
// echo $cont;
$from = $object->cond_select('ig_configuration','site_email','site_id=1');
$to = $fetch_res['email_id'];
$SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $cont);
$SMTPChat = $SMTPMail->SendMail();
$redirect_url = "?action=detail_form&result=success";
}
//exit();
$redirect_page = 1;
break;
case 'newsletter_send':
$from = $_REQUEST['from'];
$subject = $_REQUEST['subject'];
$shop_id = $_REQUEST['shop'];
/*$deal_id = $_REQUEST['deal_id'];*/
$city_id = $_REQUEST['city_id'];
$limit = $_REQUEST['limit'];
$message = $_REQUEST['message'];
$deals = "<html><head><title>Untitled Document</title></head><body bgcolor='#999966'>
<table align='center' width='679' bgcolor='#333333'>
<tr style='background:#333' height='100'>
<td width='170' style='margin-right:15px;'><img src='".$site_url."/images/logo/logo.png' width='160' height='40' alt='' style='margin-top:3px;' /></td>
<td width='497' align='center'><font color='#FFFFFF'>
<h2><a href='".$site_url."' style='text-decoration:none; color:#FFF'>".$site_url."</a></h2>
</font></td>
</tr>
<br/>
</table>";
$deal_name_query = mkr_select('ig_deals','*','deal_status=1 AND deal_shop_id = '.$shop_id.' AND now() BETWEEN deal_start_date_time AND deal_end_date_time ORDER BY deal_percentage DESC LIMIT '.$limit);
while($fetch_deals = fetch_array($deal_name_query))
{
$image = $object->cond_select('deal_images','image1_path','deal_id='.$fetch_deals['id']);
$deals .=
"<table align='center' width='679' bgcolor='#cccccc' style='margin-top:-20px'>
<tr bgcolor='#cccccc'>
<td width='180'><b><a href='".$site_url."/my_deals/deal_details.php?deal_id=".$fetch_deals['id']."&deal_name=".$fetch_deals['deal_name']."' style='color:#000;'>".substr($fetch_deals['deal_name'], 0, 48)." </a></b> <a href='".$site_url."/my_deals/deal_details.php?deal_id=".$fetch_deals['id']."&deal_name=".$fetch_deals['deal_name']."'><img src='".$site_url.'/'.$image."' width='280' height='163' alt='sold'></a></td>
<td><font style='text-align:justify' size='-1'>
<p>". substr($fetch_deals['deal_subject'],0,250)."<a href='".$site_url."/my_deals/deal_details.php?deal_id=".$fetch_deals['id']."&deal_name=".$fetch_deals['deal_name']."' style='color:#FFF; text-decoration:none;'> more...</a></p>
</font>
<table bgcolor='#ccc'>
<tr>
<td style='width:80px; background:#212121; color:#FFF;' align='center' >Actual<br/>
$".$fetch_deals['deal_actual_amount']."</td>
<td align='center' style='width:80px; background:#212121; color:#FFF;' >Discount <br/>
".$fetch_deals['deal_percentage']."%</td>
<td align='center' style='width:80px; background:#212121; color:#FFF;' >You Save <br/>
$".$fetch_deals['deal_deal_amount']."</td>
</tr>
</table>
</font>
<input type='button' onclick='".$site_url."/my_deals/deal_details.php?deal_id=".$fetch_deals['id']."&deal_name=".$fetch_deals['deal_name']."' value='view' style='background-image:url(../../images/ter.jpg);'/></td>
</td>
</td>
</tr>
<tr><td> </td></tr>
</table>";
}
$site_name = $object->cond_select('ig_configuration','site_name','site_id=1');
$SQL_query = mkr_select("ig_newsletter",'*','city_id = '.$city_id.' AND status=1');
while($fetch_res = fetch_array($SQL_query))
{
$deals .="<table width='679' style='margin:auto' bgcolor='#333333'> <tr>
<td align='center'><a href='".$site_url."' style='text-decoration:none; color:#FFF'>".$site_url." all rights reserved</a><br/>
Privacy Policy |<a href='".$site_url."/my_deals/news_unsub.php?email_id=".base64_encode(strrev($fetch_res['email_id']))."' style='color:#FFF;'> Unsubscribe </a>| Terms of Service<br/>
<br/>
</font></td>
</tr>
</table>";
$email = $fetch_res['email_id'];
$cont="<p><h3>Merhaba,$fetch_res[email_id],</h3></p>
<p>".$subject."</p>
<p>".$message."</p>
<p> $deals</p>";
/*$mailheader="From:".$from." \r\n";
$mailheader=$mailheader."Reply-to:".$from." \r\n";
$mailheader=$mailheader."MIME-Version: 1.0 \r\n";
$mailheader=$mailheader."Content-Type: text/HTML; charset=ISO-8859-1 \r\n";
$mailheader=$mailheader."X-mailer: PHP/".phpversion();
mail($email,$subject,$cont,$mailheader); */
/* SMTP SETTINGS */
$from = $object->cond_select('ig_configuration','site_email','site_id=1');
$to = $email;
$SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $cont);
$SMTPChat = $SMTPMail->SendMail();
/* SMTP SETTINGS */
$redirect_url = "?action=newsletter&result=success";
// $redirect_url = "";
}
$redirect_page = 1;
// exit();
break;
}
if($redirect_page == 0)
{
switch($view)
{
case "list_form":
include('list_files/email_sub_list_ajax.php');
break;
case "detail_form":
include('view/email_detail_view.php');
break;
case "newsletter":
include('view/news_letter.php');
break;
}
}
if($redirect_page == 1)
{
//header("location:".$redirect_url);
echo "<script> window.location ='".$redirect_url."'</script>";
}
?><?php
$SmtpServer="mail.xxxx.com";
$SmtpPort="587";
$SmtpUser="info@xxxx.com";
$SmtpPass="xxxx";
?>
Verimerkezi php versyon header mimi problemi var dedi bende ona istinaden tekrardan düzenleme yaptım
<?php require('library.php');
require '../../common/class.phpmailer.php';
error_reporting(0) ;
$object = new IG_Class();
$site_url = $object->cond_select('ig_configuration','site_url','site_id=1');
$site_name = $object->cond_select('ig_configuration','site_name','site_id=1');
$action = @$_REQUEST['action'];
$view = $action;
$redirect_page = 0;
$redirect_url = '';
$mail = new PHPMailer(true); //New instance, with exceptions enabled
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 587; // set the SMTP server port
$mail->Host = "mail.xxxxxx.com"; // SMTP server
$mail->Username = "info@xxxxxx.com"; // SMTP server username
$mail->Password = "xxxxxx"; // SMTP server password
$mail->IsSendmail(); // tell the class to use Sendmail
$mail->AddReplyTo($object->cond_select('ig_configuration','site_email','site_id=1'),$site_name);
$mail->From = $object->cond_select('ig_configuration','site_email','site_id=1');
$mail->FromName = $site_name;
#### Page navigation
$table = 'ig_users';
$condition = 'email_subscribe = 1 AND user_status=1';
$page_result = '20';
include('../../common/page_nav.php');
#### Page navigation
switch($action)
{
case 'send':
$from = $_REQUEST['from'];
$city = $_REQUEST['city'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];
$site_name = $object->cond_select('ig_configuration','site_name','site_id=1');
$SQL_query = mkr_select("ig_newsletter",'*','city_id='.$city);
while($fetch_res = fetch_array($SQL_query))
{
$body="<p><h3>Merhaba,$fetch_res[email_id],</h3></p>
<p> $message</p>";
//$body = file_get_contents('contents.html');
$body = preg_replace('/\\\\/','', $body); //Strip backslashes
$to = $fetch_res['email_id'];
/* SMTP MAIL CONFIG */
$mail->AddAddress($to);
$mail->Subject = $site_name. "NewsLetter ".date("d-m-Y");
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();
/*if(!$mail->Send()) {
echo "Mailer Error (" . str_replace("@", "@", $row["email_id"]) . ') ' . $mail->ErrorInfo . '<br />';
} else {
echo "Message sent to :" . $row["email_id"] . ' (' . str_replace("@", "@", $row["email_id"]) . ')<br />';
}*/
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
/* SMTP MAIL CONFIG */
//echo $body;
}
// exit();
$redirect_url = "?action=detail_form&result=success";
$redirect_page = 1;
break;
case 'newsletter_send':
$from = $_REQUEST['from'];
$subject = $_REQUEST['subject'];
$shop_id = $_REQUEST['shop'];
/*$deal_id = $_REQUEST['deal_id'];*/
$city_id = $_REQUEST['city_id'];
$limit = $_REQUEST['limit'];
$message = $_REQUEST['message'];
$deals = "<html><head><title>Untitled Document</title></head><body bgcolor='#999966'>
<table align='center' width='679' bgcolor='#333333'>
<tr style='background:#333' height='100'>
<td width='170' style='margin-right:15px;'><img src='".$site_url."/images/logo/logo.png' width='160' height='40' alt='' style='margin-top:3px;' /></td>
<td width='497' align='center'><font color='#FFFFFF'>
<h2><a href='".$site_url."' style='text-decoration:none; color:#FFF'>".$site_url."</a></h2>
</font></td>
</tr>
<br/>
</table>";
$deal_name_query = mkr_select('ig_deals','*','deal_status=1 AND deal_shop_id = '.$shop_id.' AND now() BETWEEN deal_start_date_time AND deal_end_date_time ORDER BY deal_percentage DESC LIMIT '.$limit);
while($fetch_deals = fetch_array($deal_name_query))
{
$image = $object->cond_select('deal_images','image1_path','deal_id='.$fetch_deals['id']);
$deals .=
"<table align='center' width='679' bgcolor='#cccccc' style='margin-top:-20px'>
<tr bgcolor='#cccccc'>
<td width='180'><b><a href='".$site_url."/my_deals/deal_details.php?deal_id=".$fetch_deals['id']."&deal_name=".$fetch_deals['deal_name']."' style='color:#000;'>".substr($fetch_deals['deal_name'], 0, 48)." </a></b> <a href='".$site_url."/my_deals/deal_details.php?deal_id=".$fetch_deals['id']."&deal_name=".$fetch_deals['deal_name']."'><img src='".$site_url.'/'.$image."' width='280' height='163' alt='sold'></a></td>
<td><font style='text-align:justify' size='-1'>
<p>". substr($fetch_deals['deal_subject'],0,250)."<a href='".$site_url."/my_deals/deal_details.php?deal_id=".$fetch_deals['id']."&deal_name=".$fetch_deals['deal_name']."' style='color:#FFF; text-decoration:none;'> more...</a></p>
</font>
<table bgcolor='#ccc'>
<tr>
<td style='width:80px; background:#212121; color:#FFF;' align='center' >Actual<br/>
$".$fetch_deals['deal_actual_amount']."</td>
<td align='center' style='width:80px; background:#212121; color:#FFF;' >Discount <br/>
".$fetch_deals['deal_percentage']."%</td>
<td align='center' style='width:80px; background:#212121; color:#FFF;' >You Save <br/>
$".$fetch_deals['deal_deal_amount']."</td>
</tr>
</table>
</font>
<input type='button' onclick='".$site_url."/my_deals/deal_details.php?deal_id=".$fetch_deals['id']."&deal_name=".$fetch_deals['deal_name']."' value='view' style='background-image:url(../../images/ter.jpg);'/></td>
</td>
</td>
</tr>
<tr><td> </td></tr>
</table>";
}
$site_name = $object->cond_select('ig_configuration','site_name','site_id=1');
$SQL_query = mkr_select("ig_newsletter",'*','city_id = '.$city_id.' AND status=1');
while($fetch_res = fetch_array($SQL_query))
{
$deals .="<table width='679' style='margin:auto' bgcolor='#333333'> <tr>
<td align='center'><a href='".$site_url."' style='text-decoration:none; color:#FFF'>".$site_url." all rights reserved</a><br/>
Privacy Policy |<a href='".$site_url."/my_deals/news_unsub.php?email_id=".base64_encode(strrev($fetch_res['email_id']))."' style='color:#FFF;'> Unsubscribe </a>| Terms of Service<br/>
<br/>
</font></td>
</tr>
</table>";
$to = $fetch_res['email_id'];
$cont ="<p><h3>Merhaba,$fetch_res[email_id],</h3></p>
<p>".$subject."</p>
<p>".$message."</p>
<p> $deals</p>";
$body = $cont;
//$body = file_get_contents('contents.html');
$body = preg_replace('/\\\\/','', $body); //Strip backslashes
/* SMTP MAIL CONFIG */
$mail->AddAddress($to);
$mail->Subject = $site_name. "NewsLetter ".date("d-m-Y");
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();
/*if(!$mail->Send()) {
echo "Mailer Error (" . str_replace("@", "@", $to) . ') ' . $mail->ErrorInfo . '<br />';
} else {
echo "Message sent to :" . $to . ' (' . str_replace("@", "@", $to) . ')<br />';
}*/
// Clear all addresses and attachments for next loop
//$mail->ClearAddresses();
/* SMTP MAIL CONFIG */
$redirect_url = "?action=newsletter&result=success";
// $redirect_url = "";
// echo $body;
}
$redirect_page = 1;
//exit();
break;
}
if($redirect_page == 0)
{
switch($view)
{
case "list_form":
include('list_files/email_sub_list_ajax.php');
break;
case "detail_form":
include('view/email_detail_view.php');
break;
case "newsletter":
include('view/news_letter.php');
break;
}
}
if($redirect_page == 1)
{
//header("location:".$redirect_url);
echo "<script> window.location ='".$redirect_url."'</script>";
}
?>Bu şekile getirdim farklı sunucuda çalışıyor php versyonu düşük olan sunucuda ama benim sunucuda çalışmıyor çalısan sunucunn php sürüm 5.2.0 ne yapıcam şaşırdım üstteki kodum gönderiyor html gözüküyor bu da işlem yapmıyor beyaz sayfa geliyor sürümden.
Beni yönlendirirmisiniz kafam karıştı biraz yardımcı olacak arkadaşlara teşekkür ediyorum.