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 ("/ 과정

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

실무 링크 자체는 다음과 같이 보입니다

send.php 안에 템플릿이 존재하는지 확인하고, 그렇다면 메일이 전송됩니다! 지금 가입 양식을 작성 후, 나는 파일에서 확인 이메일을 보낼 때 누군가 책 과정이나 뭐,

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)

내 send.php 파일의 경로와 내 finish.php 파일 께서 그냥 file_get_contents : file_get_contents와 finish.php에서 사용하려고 할 때

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

이제 문제는, 그 존재 나던 템플릿을 말한다있다 ... 파이어 폭스에 같은 링크를 복사하면 모든 것이 작동합니다 .. 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

는 자, 이제 모든 것이 잘 작동 하하 가능한 밤은!

문제는 .. URL에 또는 내가 모든 단일 변수를 urlencode하지 않았기 때문에 약간의 공백으로 하나가

아아 너무 많은 시간이 발생했다!