发送pdf作为附件时,php脚本重定向

时间:2015-02-21 11:20:00

标签: php wordpress email pdf

我是php编程的新手,我使用TCPDF库开发php脚本,从pdf表单字段获取数据并使用TCPDF创建该PDF的展平副本,之后我使用“AttachMailer.php”将PDF副本发送到客户和客户,当用户填写pdf表单并单击提交按钮时,在wp-content / uploads / pdf文件夹中创建该pdf的副本,并且 电子邮件代码从wp-content / uploads / pdf文件夹获取相同副本,并且一旦转发副本,副本将转发给客户端和客户,它应显示消息“电子邮件已发送.....电子邮件地址”。

 // =============Email Form===============================
require_once(dirname(__FILE__)."/AttachMailer.php");
$mailer = new AttachMailer($Email, $Email, "Submitted Form Copy", "hello <b>Please Find the Attached Copy of form sumitted</b>");

$mailer->attachFile($fpath.$Contact_Name.'_'.$Email.$fID);

$mailer1 = new AttachMailer($Email,$CEmail, "CC for client Submitted Form ", "hello <b>Please Find the Attached Copy of form sumitted by </b>".$Contact_Name);

$mailer1->attachFile($fpath.$Contact_Name.'_'.$Email.$fID);

if($mailer->send()) {
   echo "Email has been sent to ".$Email."\n and" ; }
else{
   echo "error in email\n";
   exit();
}
if($mailer1->send()){
    echo "\nCC has been sent to ".$CEmail ; 
}
else{echo "\nerror in email CC was not sent to ".$CEmail;}!

问题是当用户点击提交按钮时,他/她被重定向到主页(我不想要),并在上面显示的电子邮件代码中执行if和else语句

请帮助我如何停止重定向到主页。

您可以在我的保管箱中看到重定向页面的屏幕截图

https://www.dropbox.com/s/t48rqemujn21q42/redirectpagescreenshot.png?dl=0

0 个答案:

没有答案