如何发送电子邮件,同时也发送详细信息到PayPal与PHP


How to send email while also sending details to PayPal at the same time with PHP

我是PHP新手,创建了一个购物小购物车,将详细信息发送到贝宝,该购物车正在运行,但我也希望客户填写他们的发货地址,并在点击结账按钮时将其通过电子邮件发送到电子邮件地址。

我不确定最好的方法,我需要这份表格的原因是,如果他们为该州选择VIC,那么运费是免费的,$_SESSION["运费"]将承担费用。

我能以某种方式采取行动吗?这样我就可以把送货地址表和贝宝结合起来了?

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
            <textarea name='message' rows='15' cols='40'>
            </textarea><br>
            <input type="hidden" name="cmd" value="_cart">
            <input type="hidden" name="upload" value="1">
            <input type="hidden" name="business" value="email@email.com">
            <?php $this->pay_pal(); ?>
            <input type="hidden" name="item_name" value="Item Name">
            <input type="hidden" name="currency_code" value="AUD">
            <input type="hidden" name="amount" value="<?php echo $total; ?>">
            <input type="image" onclick="return checkConditions();" src="http://www.paypal.com/en_US/i/btn/x-click-but03.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
            <input type="hidden" name="return" value="http://www.somewhere.com">
        </form>

就像almoullim说的

你可以从这里下载phpmailer

http://phpmailer.worxware.com/

这是的教程

http://blog.teamtreehouse.com/sending-email-with-phpmailer-and-smtp

在将访问者带到PayPal的页面中放入另一个发送邮件的代码你可以使用PHPMailer

就我而言,我做了一个CMS当任何人在他的网站上安装CMS脚本时它给我发了一封电子邮件有人安装了我的CMS脚本和网站的URL所以我知道,如果我的脚本使用或不使用,如果有任何错误

我使用了PHPmailer和SMTP

使用此代码

  if (isset($_POST['send']) and $_POST['send'] == 'sendmail') {
$sendmail = require_once('../lib/phpmailer/class.phpmailer.php');
    include("../lib/phpmailer/class.smtp.php"); // optional, gets called from within          class.phpmailer.php if not already loaded
  $mail             = new PHPMailer();
 $body = "
 <br>
 Website Name : $qr->sname
 <br>
 Website url : $qr->surl
<br>
$qmsg";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "smtp.gmail.com"; // sets the SMTP server
$mail->Port       = 465;                    // set the SMTP port for the GMAIL server
$mail->Username   = "mail@gmail.com"; // SMTP account username
$mail->Password   = "pass";        // SMTP account password
$mail->SetFrom('$qemail', 'Almoullim CMS');
$mail->Subject    = "Almoullim CMS Report - $qsubject";
$mail->MsgHTML($body);
$address = "mail@gmail.com";
$mail->AddAddress($address, "Almoullim CMS");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
}
if (isset($sendmail)) {
die ("
        <center>
        <div class='head'>تــــــــم</div>
        <div class='bodypanel'>
        <br>
        ارســـــال التــــقرير بنــــجاح
        <br>
        <br>
        </div>
        </center>
        <meta http-equiv='refresh' content='4; url=?cpages=report' />
");

}
}
?>