これは、このコミュニティでの最初の質問です。しかし、技術的な問題が発生したため、長い間使用しており、非常に助かっています。
とにかく私の質問は:
次を使用して、別の PHP ファイル shopping_cart.php から mail_contents.php の div にコンテンツをロードしています。
$("#mail_contents").load('shopping_cart.php #cart_contents');
ブラウザで mail_contents.php を直接開くと、コンテンツも表示されます。
しかし、問題は、以下のコードを使用して、このphpファイルの内容を電子メールで送信しようとしているときです:
.....
$mailer = new PHPMailer();
$mailer->CharSet = 'utf-8';
$mailer->IsHTML(true);
$mailer->AddAddress($this->UserEmail());
$mailer->Subject = "You have placed an order with ".$this->sitename;
$mailer->From = $this->GetFromAddress();
$mailer->FromName = "POR";
ob_start();
include 'mail_contents.php';
$content = ob_get_clean();
$mailer->Body = $content;
if(!$mailer->Send()){
$this->HandleError("Failed sending user welcome email.");
return false;
}
return true;
....
動的にロードされたコンテンツを見ることができません。echo ステートメントを使用して mail_contents.php ファイルに静的コードを追加したところ、メールに正常に表示されることがわかりました。私が何か間違ったことをしている場合は、私を導いてください。
ありがとうございます!