简体   繁体   中英

PHP mail not working with Exchange 2013

I used this code previously and it worked with Microsoft exchange 2010. Now that my corporation uses Microsoft exchange 2013, it does not work.

Can anyone tell me why this is happening?

<?php

ini_set ("SMTP","mail.***.com");
ini_set("sendmail_from","motabaat@***.com");
$to         = $row_assignto['Email'];      //$row_senmailto['Email'];
$subject    = $row_DetailRS1['TaskName'];
$mail_body  ='<html>
  <p align="right"><strong>
  الاخوة والاخوات     مع حفظ الألقاب
  </strong></p>
  <p align="center"><strong>  الموضوع : ' .$subject. ' </strong></p>
  <p align="right"><strong> ,,,تحية طيبة وبعد  </strong></p>        
  <p align="right"><strong>  يهديكم مكتب معالي الأمين  العام  أسمى التحيات، وبرجاء متابعة     الموضوع أعلاه </strong></p>
  </strong></p>
  <p align="right"><strong>.
  لمعاينة المتابعة <a href="my link"> إضغط هنا </a> </strong></p>
  <p>&nbsp;</p>
  <p align="center"><strong>وتفضلوا بقبول فائق الإحترام     والتقدير،،،،</strong></p>
  <p align="left"><strong>  مكتب معالي الأمين  العام   
  </body>  
  </html>';


$header .= "MIME-Version: 1.0\r\n";
$headers = "Content-type: text/html" . "\r\n" .
$headers .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$headers .= "motabaat@pmo.gov.ps" . "\r\n" . 
"CC:".$row_DetailRS1['AssignCc'];


mail($to, $subject, $mail_body, $headers); 

echo "<meta http-equiv=\"refresh\" content=\"0;URL=indexadmintask.php\">"; 

?>

This may not be your whole problem, but I'm sure this doesn't help:

$header .= "MIME-Version: 1.0\r\n";
$headers = "Content-type: text/html" . "\r\n" .
$headers .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$headers .= "motabaat@pmo.gov.ps" . "\r\n" . 
"CC:".$row_DetailRS1['AssignCc']; 

should be rewritten as:

$header = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html" . "\r\n";
$headers .= "Content-Transfer-Encoding: 7bit" . "\r\n\r\n";
$headers .= "Reply-To: motabaat@pmo.gov.ps" . "\r\n"; // guess
$headers .= "Cc: " . $row_DetailRS1['AssignCc'];

That's assuming the actual content of the headers is correct...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM