我正在使用插件wordpress-simple-paypal-shopping-cart 对于我的购物车要求。我试图通过这个插件发送电子邮件时,一些付款是通过使用IPN。
我的代码:
$invoiceProducts = $_SESSION[\'simpleCart\'];
if(isset($invoiceProducts) && !empty($invoiceProducts)){
$html = renderHTML($invoiceProducts);
generatePDF($html);
unset($invoiceProducts);
}
function renderHTML($param){
$IPN = $_POST;
$name = $IPN[\'first_name\'];
$donationAmount = $IPN[\'payment_gross\'];
$contributorsEmail = $IPN[\'payer_email\'];
$contributorsPhone = $IPN[\'payer_email\'];
$contributorsAddr = $IPN[\'address_name\'] . \', \' . $IPN[\'address_city\'] . \', \' . $IPN[\'address_country\'];
//We will need to shoot email to laura of successfull payment.
$to = \'[email protected]\';
$subject = \'Donation made on your website\';
$message = \'\';
$message .= \'<html><body>\';
$message .= \'<p>You have received a contribution from<strong>\'.$name.\'</strong> of <strong>\'.$donationAmount.\'</strong></p>\';
$message .= \'<p>Contributor Information:</p>\';
$message .= \'<ul>\';
$message .= \'<li>Name:\'.$name.\'</li>\';
$message .= \'<li>Amount:\'.$donationAmount.\'</li>\';
$message .= \'<li>Email:\'.$contributorsEmail.\'</li>\';
$message .= \'<li>Address:\'.$contributorsAddr.\'</li>\';
$message .= \'</ul>\';
$message .= \'</body></html>\';
wp_mail( $to, $subject, $message, $headers, $attachments );
}
但调用此函数时,我会遇到以下错误:
Fatal error: Call to undefined function wp_mail()
我知道为什么会出现这个错误,只是我的插件是先加载的,而不是先加载的wp_mail()
.
就我而言,我该怎么打电话wp_mail()
先是我的插件?