0

What i want to accomplish is:

  • call a function from a file

  • that function returns me a variable with the correct html template

  • pass the return of this function to another function and use it as body in phpMailer.

I have a page request.php where i call getEmailTemplate() from ManageEmailtemplates.php to get the correct html template and store it to variable: $body=getEmailtemplate();

  function getEmailTemplate(){
     $template='<html><body> html data </body> </html>'; 
     return $template;
  }

then i want to pass this variable to another file cls_mailHandler.php and use it as body to email.

function NewRequestMail($template){ 
   .
   .
   .
   .
   .
   $mail->Body    = $template;
   $mail->isHTML(true); 
}

The problem is that when i try this way my emails sent i can see them on my mobile but on mail client on browser nothing show up(gmail, hotmail...)

If i change this $body=getEmailtemplate(); to this $body="'".getEmailtemplate()."'"; then in hotmail shows up html content with the ' at the beginning and at the end. But gmail nothing.

Is there any specific way that i have to pass html data inside variable and use them?

thank you

1 Answers1

0

Try this format please, I checked it and it works

<!DOCTYPE html>
<head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> <title>Jetbull Affiliates </title> 

<meta name='viewport' content='initial-scale=1'> 
<meta http-equiv='Content-Type' content='text/html;'> 
</head>
<body>
<!-- Content here -->
</body>
</html>
Davit Huroyan
  • 296
  • 3
  • 15
  • I tried your sample and works for me too. I don't know if the Doctyte is the answer but I think that something in my html is what created this problem(i got my html from an email template creator). When i delete all the code for IE support in my html worked fine. – Achilleas Tsavos Oct 01 '18 at 13:10