I have weird problem with my gae php application

i checked the code and noticed that one of the email-sending pages was 
using php mail and not googles's new Message() - method.
But it did work somehow, i can't understand why because i read the docs 
year or 2 ago that mail -function is not in use.
Now i changed it to new Message() -method but the email gets parsed as text 
and my html tags are visible in the thunderbird when i receive the mail.
Also i did not find anymore the new Message() documentation from google's 
site

1. is mail() now actually supported ?
2. how do i get html mail

runtime: php55

this is the code that makes tags visible:

require_once 'google/appengine/api/mail/Message.php';
use \google\appengine\api\mail\Message;

$daterand=date("Y-m-d").' '.rand(1000,9999);
$subject = "New mail - $daterand";

$eol="\n";
$Momentn = mktime().".".md5(rand(1000,9999));
$Servername = ereg_replace("www.","",$_SERVER["SERVER_NAME"]);
if(strlen($Servername)<2)$Servername = "PHPMAILSERVER";

$headers= 'To: '.$email;
$headers.=$eol;
$body = "welcome to the app!<br />";
$body.="\r\nLinks and stuff, thanks!</i><br />";


//$headers= 'To: '.$my_email; //not allowed 2013

$headers      .= 'From: '.$sender_email.$eol; //ei itseä ! google ei tykkää
//GAE DOES NOT ACCEPT: $headers      .= "Message-ID: 
<".$Momentn."@".$Servername.">".$eol;
//GAE DOES NOT ACCEPT: $headers      .= 'Date: '.date("r").$eol;
$headers .= "Content-Type: text/html; charset=UTF-8".$eol;
//GAE DOES NOT ACCEPT:$headers .= "MIME-Version: 1.0\n";
//GAE DOES NOT ACCEPT:$headers .= "Content-transfer-encoding: 7bit\n";
//$mailresult=mail('', $subject, $body, $headers);

if($appengine) {
//use \google\appengine\api\mail\Message;

$body = '<html><body>'.$body.'</body></html>';
try
{
  $message = new Message();
  $message->setSender($sender_email);
  $message->addTo($email);
  $message->setSubject($subject);
  $message->setTextBody($body);
  $message->send();
  $mailresult=true;
} catch (InvalidArgumentException $e) {
  $mailresult=false;
}


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/6eb870c2-215e-4f40-a702-2c8124f1ce01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to