如何知道我的邮件发送到收件人在php


How to know my mail send to recevier in php

我在发送邮件时遇到了一些问题,我的邮件没有发送到收件人。但是请给我回邮件。我的代码在这里,请给我建议

 <?php 
   if(isset($_POST["c_submit"]))
   {
    if(($_POST['captcha']!="") || ($_SESSION['captcha_id'])!="")
    {
     if($_POST['captcha']==$_SESSION['captcha_id']) { 
        $to_customer = $_POST["mail"];
    $subject = "Thanking you for Contacting US";
    $mail_body = "
   <html>
    <head>
   <title>Thanking you for Contacting</title>
   </head>
    <body>
   <font face='Verdana'>
   Dear&nbsp;&nbsp;".$_POST["name"].",</br>
   <p>Thank you for visiting our website. We have received your enquiry through our web         form. We appreciate you considering</p>
      <p>Sincerely,</p>
        <b>Penis Plug. Ltd.</b><br />
      Website:". $site."<br />
        Email:" .$email."<br />
         <br />
      <br />
       </font>
     </body>
         </html>";
       $to = "ashish.sws@gmail.com";
        $mail_subject = "Contact Form Mail";
       $to_mail_body = "
        <htm>
     <head>
       <title>Customer Details</title>
       </head>
       <body>
        <font face='Verdana'>
         <table>
        <tr>
       <th>Name : </th>
      <td>".$_POST["name"]."</td>
         </tr>
          <tr>
         <tr>
          <th>Message : </th>
         <td>".$_POST["message"]."</td>
        </tr>
        <tr>
          <th>Email </th>
         <td>".$_POST["email"]."</td>
            </tr>
        <tr>
            <th>Contact No. : </th>
           <td>".$_POST["phone"]."</td>
          </tr>

         <tr>
          <th>Company : </th>
          <td>".$_POST["company"]."</td>
           </tr>
           </table>
           </font>
           </body>
           </html>
    ";
    $headers  = 'MIME-Version: 1.0' . "'r'n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "'r'n";
     $headers .= 'From:   '.'http://www.swatiwebtechnologies.com'.'<'.'ashish.sws@gmail.com'.'> ' . "'r'n"; 

    if(@mail($to_customer,$subject,$mail_body,$headers))  
    {  
   echo "Mail send completed.";  
   }  
   else  
   {  
   echo "Cannot send mail.";  
     }  

        @mail($to,$mail_subject,$to_mail_body,$headers);

        } else if($_POST['captcha']!=""){
            echo '<font color="red"><b>Not Matching, Try Again...</b></font>';
        }
     }
         }
       ?> 

我在这里发送了两封邮件,一封给客户,一封给自己。在客户邮件中出现问题,自己的邮件工作正常,请建议我

根据文档,如果发送失败,函数返回false

$flgSend = @mail(...);

如果这导致您的代码显示"邮件发送完成",但它仍然没有出现在您的收件箱中,那么要么它还没有到达,要么是垃圾邮件过滤器捕获了它。

试试这个检查邮件发送

if(@mail($to_customer,$subject,$mail_body,$headers))  
{  
echo "Mail send completed.";  
}  
else  
{  
echo "Cannot send mail.";
} 

建议:

  • 如果去掉错误抑制操作符,准确的错误是什么?
  • 您确定from:部分的http://www.com是有效的吗?
  • 许多垃圾邮件拦截列表提供商将阻止你的邮件,如果你没有认证加密。然后,回复到你的收件箱,说你的邮件没有送达。
  • 在这里搜索"mail php",它会给你带来几十个想法。是这样的:PHP mail() -邮件不发送