Php电子邮件无法在iframe中运行

时间:2015-01-05 22:44:21

标签: javascript php html iframe

我写了这个PHP代码,用于创建报告模板,填写字段并发送电子邮件。 我也创建了这个页面的iframe。 代码工作正常,正在发送电子邮件,但它没有通过iframe发送电子邮件。

$email_to = "****@gmail.com";
                                $email_subject = "Subject" ;

                               $message = '<html>';
                               $message .= '<head><style>table,th,td {padding: 0px; border:1px solid black; border-collapse: collapse; font-size: 16px;}</style></head>';
                               $message .= "<body><table style='border-collapse: collapse; border: 1px solid black;  font-size: 18px; width: 800px;  border-radius: 10px; margin-left: auto; margin-right:auto; '>";
                               $message .= "<tr><th style='background-color:#E0E0E0;' colspan=\"2\"><h1 style=' margin-top:15px; color: #9FD056; text-align: center;'> Report For Review</h1></th></tr>";
                               $message .= "<tr><td><h2 style='text-align: center;'>".$cb."</h2></td><td><h2 style='text-align: center;'>02/08/2015</h2></td></tr>";

                                $message .= "<tr><td><h2 style='color: red; text-align: center; '>Questions</h2></td><td><h2 style='color: red; text-align: center;'>Answers</h2></td></tr>";

                                for($j=0; $j<sizeof($_SESSION['yes_questions']);$j++){
                                $message .= "<tr><td>".$_SESSION['yes_questions'][$j]."</td><td style='text-align: center;'>".$_SESSION['yes_answer'][$j]."</td></tr>";
                                 }

                                $message .= "<tr><td style='background-color:#E0E0E0;' colspan=\"2\"><h1 style=' margin-top:15px; color: #9FD056; text-align: center;'>Preventive Questions</h1></td></tr>";
                                $message .= "<tr><td><h2 style='color: red; text-align: center;'>Questions</h2></td><td><h2 style='color: red; text-align: center;'>Answers</h2></td></tr>";

                                for($i=0; $i<sizeof($_SESSION['p_questions']);$i++){
                                $message .= "<tr><td>".$_SESSION['p_questions'][$i]."</td><td style='text-align: center;'>".$_SESSION['p_answers'][$i]."</td></tr>";
                                 }

                                $message .= '</table>';
                                $message .= "<table style='width: 500px; margin-left:auto; margin-right: auto; margin-top:30px;'>";
                                $message .= "<tr><th style='background-color:#E0E0E0;'><h1 style=' margin-top:15px; color: #9FD056; text-align: center;'>Results</h1></th></tr>";
                                for($k=0; $k<sizeof($_SESSION['arr']);$k++){
                                $message .= "<tr><td><h3 style='color: red; text-align: center;'>".$_SESSION['arr'][$k]." is ".$_SESSION['arr2'][$k]."%</h3></td></tr>";
                                }
                                $message .= '</table>';
                                $message .= '<br/><h1>Note:</h1>';
                                $message .= "<h3 style='color: red; margin-left: 100px;'>Kindly Review This Report and Write Your Remarks.</h3>";
                                $message .= '</body></html>';

                                $headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
                                $headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
                                $headers .= "CC: susan@example.com\r\n";
                                $headers .= "MIME-Version: 1.0\r\n";
                                $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
                                @mail($email_to, $email_subject, $message, $headers);  
                        echo '<h1 style="color: black">We Review Your Test And Will Get Back To You Soon..Thanks!!</h1>';

我该如何解决这个问题? 提前谢谢。

0 个答案:

没有答案