0
我應該怎麼做?基本上我有下面的代碼,$ pdf是pdf文件的base64編碼字符串wp_mail發送帶有編碼字符串的電子郵件作爲附件
add_action('wp_ajax_email_portfolio', 'ajax_email_portfolio');
function ajax_email_portfolio()
{
check_ajax_referer('ajax-email-portfolio', 'security');
$pdf = $_POST['pdf'];
$email_address = $_POST['email_address'];
#NOTIFY USER
$subject = 'Portfolio from somewhere';
$headers = 'From: Someone <[email protected]>';
$email_body = 'Portfolio from Someone';
$destination_email = $email_address;
wp_mail($destination_email, $subject, $email_body, $headers);
echo json_encode(array('success' => true,'pdf'=> $pdf,'email_address'=>$email_address));
die();
}
任何幫助將不勝感激!
你的'add_action'函數在做什麼? – wahwahwah
@wahwahwah它正在註冊這個功能,就是它 – kwokkaki
只是建立你的html數據包(帶頭)你怎麼沒有併發症....如果*編碼*是一個問題,那麼我認爲你需要改變你的問題, – wahwahwah