1
サブスクリプションオプションに従って自動的に生成される添付ファイル付きのメールを送信しようとしています。しかし、メールが送信されるたびに(迷惑メールで)添付ファイルは送信されません。ここでこのトピックを検索しましたが、すべてのソリューションは「アップロード」フォルダに関連しています。ここで wp_mail()内の添付ファイルが自動生成されません
私のコードがある
..require (ABSPATH . 'pdfcrowd.php');
try
{
// create an API client instance
$client = new Pdfcrowd("apiname", "apikay");
// convert a web page and store the generated PDF into a $pdf variable
$pdf = $client->convertFile(ABSPATH . 'invoice_html.php');
// set HTTP response headers
header("Content-Type: application/pdf");
header("Cache-Control: max-age=0");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"invoice.pdf\"");
//$to = $invoice_email;
$to = "[email protected]";
$subject = "Invoice for your online package.";
$message = "Message Body Invoice for your online package. Invoice for your online package. Invoice for your online package";
$headers = array('Content-Type: text/html; charset=UTF-8','From: My Site Name <[email protected]');
$attachments = $pdf;
// send the generated PDF
//echo $attachments;
$wp_mail = wp_mail($to, $subject, $message, $headers, $attachments);
}
catch(PdfcrowdException $why)
{
echo "Pdfcrowd Error: " . $why;
}
任意のヘルプ?
N.B:私はブラウザでPDFファイルを出力して保存することができたので、このpdfファイルをディレクトリに保存してから添付ファイルとして送信したいと思います。上記のコードで何が最善のものになるでしょうか?
おかげ