我是appcelerator的新手。我想在警告对话框的消息属性中插入html模板。当将消息添加为字符串时,它工作正常,但我想插入html模板。我到目前为止所尝试的内容提到了吼叫,但它不起作用。
// Settings
$name = "Name goes here";
$email = "someome@anadress.com";
$to = "$name <$email>";
$from = "Gyan-Shah ";
$subject = "Here is your attachment";
$mainMessage = "Hi, here's the file.";
$fileatt = "./test.pdf"; //file location
$fileatttype = "application/pdf";
$fileattname = "newname.pdf"; //name that you want to use to send or you can use the same name
$headers = "From: $from";
// File
$file = fopen($fileatt, 'rb');
$data = fread($file, filesize($fileatt));
fclose($file);
// This attaches the file
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$mainMessage . "\n\n";
$data = chunk_split(base64_encode($data));
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatttype};\n" .
" name=\"{$fileattname}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{$fileattname}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
// Send the email
if(mail($to, $subject, $message, $headers)) {
echo "The email was sent.";
}
else {
echo "There was an error sending the mail.";
}
答案 0 :(得分:0)
Appcelerator不是基于HTML的环境,如PhoneGap。 Appcelerator / Titanium在JavaScript环境中公开本机控件。你不能做你想要的本地(UIAlert / Alert类支持文本,而不是HTML)。所以,你不能在Titanium中做到这一点。花一点时间阅读文档并查看你会在那里找到的样本。
要创建您在问题中显示的屏幕,您需要创建包含标签,TextFields,TextAreas和按钮的视图。我知道,这可能听起来像所有HTML的东西。但事实并非如此,那些将是本土组件的表现形式。