php
  • email
  • cron
  • 2017-06-15 54 views -1 likes 
    -1

    我在核心php中写了cron作业,邮件发送代码也在那里..由于cron表正确更新,但邮件发送不是工作..cron作业中的邮件代码(核心php),表格正在上传,但邮件发送不起作用

    我的代码:

    <?php 
    .............. 
    .............. 
    $subject =  "Thank you"; 
    
             $message =  '<table border="0" cellpadding="0" cellspacing="0" width="600" style="font-family: Tahoma, Geneva, sans-serif;font-size: 13px;width:600px; margin:20px auto;"><tr bgcolor="#00ADEF"><td align="center" valign="top" width="100%" style="font-family: Tahoma, Geneva, sans-serif;font-size: 13px;"><table border="0" cellpadding="10" cellspacing="0" width="100%" style="font-family: Tahoma, Geneva, sans-serif;font-size: 13px;"><tr align="center"><td><img src="path/cronjobs/cron_mail_img/mailTempLogo.png" width="198" style="max-width:198px; margin-top: 30px; margin-bottom: 30px;" /></td></tr></table></td></tr><tr bgcolor="#f5f5f5"><td align="center" valign="top" width="100%" class="templateColumnContainer"><table border="0" cellpadding="10" cellspacing="0" width="100%" style="font-family: Tahoma, Geneva, sans-serif;font-size: 13px;"><tr><td class="templateColumnContainer" style="padding:0px 20px;"><p style="font-size:16px; margin-bottom:5px;"><strong>Hi '.$row['payer_fname'].', </strong></p><p style="font-size:16px; margin-bottom:5px;">Thank you for choosing.. !</p><p style="font-size:16px; margin-bottom:5px;">Hope you had a great time.</p><p style="font-size:16px; margin-bottom:5px;">Please share your experience with us by just rating the property where you were living.</p><p style="font-size:16px; margin-bottom:5px;">Please <a href="path/rating/rating.php?prp_id='.base64_encode($row['property_id']).'&usr_id='.base64_encode($row['user_id']).'">rate the property..!</a></p></td></tr><tr style="background-color: #f5f5f5;"><td style="padding:20px;"><p style="font-size:16px; margin:10px 0;">Thanks, </p><p style="font-size:16px; margin:10px 0;">Team XYZ </p></td></tr><tr align="center" style="background-color: #f5f5f5;"><td style="border-top:solid 1px #CCC"> <img src="path/cronjobs/cron_mail_img/ftr-logo.png" width="39" /></td></tr></table></td></tr></table>'; 
    
    
             $headers = "MIME-Version: 1.0" . "\r\n"; 
             $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; 
             $headers .= 'From: Domain<[email protected]>' . "\r\n"; 
    
             mail($row['payer_email'], $subject, $message, $headers); 
    .............. 
    .............. 
    ?> 
    

    请建议东西..

    +0

    而“邮件发送不工作”是指什么_exactly_? – arkascha

    +0

    你有错误信息吗?你在http服务器错误日志文件中看到什么吗?你在垃圾邮件文件夹中收到邮件吗?消息是否返回? – arkascha

    回答

    0

    检查波纹管代码,你可以不通过电子邮件

    $to = "[email protected]"; 
    $subject ="Thank you"; 
    
    $message = '<table border="0" cellpadding="0" cellspacing="0" width="600" style="font-family: Tahoma, Geneva, sans-serif;font-size: 13px;width:600px; margin:20px auto;"><tr bgcolor="#00ADEF"><td align="center" valign="top" width="100%" style="font-family: Tahoma, Geneva, sans-serif;font-size: 13px;"><table border="0" cellpadding="10" cellspacing="0" width="100%" style="font-family: Tahoma, Geneva, sans-serif;font-size: 13px;"><tr align="center"><td><img src="path/cronjobs/cron_mail_img/mailTempLogo.png" width="198" style="max-width:198px; margin-top: 30px; margin-bottom: 30px;" /></td></tr></table></td></tr><tr bgcolor="#f5f5f5"><td align="center" valign="top" width="100%" class="templateColumnContainer"><table border="0" cellpadding="10" cellspacing="0" width="100%" style="font-family: Tahoma, Geneva, sans-serif;font-size: 13px;"><tr><td class="templateColumnContainer" style="padding:0px 20px;"><p style="font-size:16px; margin-bottom:5px;"><strong>Hi '.$row['payer_fname'].', </strong></p><p style="font-size:16px; margin-bottom:5px;">Thank you for choosing.. !</p><p style="font-size:16px; margin-bottom:5px;">Hope you had a great time.</p><p style="font-size:16px; margin-bottom:5px;">Please share your experience with us by just rating the property where you were living.</p><p style="font-size:16px; margin-bottom:5px;">Please <a href="path/rating/rating.php?prp_id='.base64_encode($row['property_id']).'&usr_id='.base64_encode($row['user_id']).'">rate the property..!</a></p></td></tr><tr style="background-color: #f5f5f5;"><td style="padding:20px;"><p style="font-size:16px; margin:10px 0;">Thanks, </p><p style="font-size:16px; margin:10px 0;">Team XYZ </p></td></tr><tr align="center" style="background-color: #f5f5f5;"><td style="border-top:solid 1px #CCC"> <img src="path/cronjobs/cron_mail_img/ftr-logo.png" width="39" /></td></tr></table></td></tr></table>'; 
    
    // Always set content-type when sending HTML email 
    $headers = "MIME-Version: 1.0" . "\r\n"; 
    $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; 
    
    // More headers optional/headers 
    $headers .= 'From: <[email protected]>' . "\r\n"; 
    $headers .= 'Cc: [email protected]' . "\r\n"; 
    
    mail($to,$subject,$message,$headers); 
    
    +0

    代码转储不能提供很好的答案。你应该解释*如何*和*为什么*这解决了他们的问题。我建议阅读,“[我如何写出一个好的答案?]”(http://stackoverflow.com/help/how-to-answer) –

    +0

    这是一个常见问题,应作为副本关闭。它不应该被回答。将来请仅将a标记为复制品。 –

    +0

    另外,请不要滥用格式化工具。 –

    相关问题