2016-08-24 5 views
0

私は電子メールを送信するためのテンプレートがたくさんあります! 私は、finish.phpのような別のファイルからfile_get_contentsといくつかのパラメータ(どのテンプレートを使うべきかを決める)を使って "呼び出し"たいphpファイル(send.phpと呼ぶことができます)を作りました!file_get_contents plus file_exists(呼び出されるファイル内)

異なるパス:

  1. テンプレート( "/ phpmailerの/テンプレート/")
  2. send.php( "/phpmailer/send.php")
  3. finish.php( "/コース/finish.php ")

作業リンク自体は次のようになります。

http://www.myadress.at/phpmailer/send.php?template=booking&[email protected]&name=Christopher 

send.phpの中に私はテンプレートが存在するかどうかチェックし、YESならばメールが送信されます!

if (file_exists(dirname(__FILE__)."/templates/".$template.".php") AND isset($email)) { 

    $mail->msgHTML(file_get_contents('https://www.myadress.at/phpmailer/templates/'.$template.'.php?'.$parameter.''), dirname(__FILE__)); 

    if (!$mail->send()) { 
     echo "Mailer Error: " . $mail->ErrorInfo; 
    } else { 
     echo "Message sent!"; 
    } 

} 
else 
{ 
    ERROR 
} 

今誰かの本コースまたは何かが、サインアップ・フォームに記入した後、私は、ファイルからの確認メールを送信したいとき、人はフォームの後に着陸さ(finish.php)

マイfinish.phpファイルHASTが私send.phpファイルへのパスを持つだけのfile_get_contents:

$sendmail= file_get_contents("https://www.myadress.at/phpmailer/send.php?template=booking-confirmation&email=".urlencode($email).""); 

今の問題は、のfile_get_contentsでfinish.phpからそれを使用しようと、彼はテンプレートのdoesntが存在すると言う場合には、 ... Firefoxと同じリンクをコピーすると、すべて動作します.. nテンプレートのameが正しいです!私は次のことを試してみた

(file_exists(dirname(__FILE__)."/templates/".$template.".php") - with dirname 
(file_exists("/templates/".$template.".php") - the normal path 
(file_exists("/phpmailer/templates/".$template.".php") - full path 
(file_exists("http://www.myadress.at/phpmailer/templates/".$template.".php") - normal url 

Pleaaaseは多分これがわかりました

答えて

0

笑可能イマイチ^^私を助けて、今ではすべてが正常に動作します!

私はすべての単一の変数をURLENCODEていなかったため、問題がえーえ...非常に多くの時間を

をURLにいくつかのスペースでいずれかによって引き起こされたりしました!

関連する問題