[英]How to Send proper html data to iphone from php?
I am sending mail content to iPhone mobile using Cakephp function. 我正在使用Cakephp功能向iPhone移动设备发送邮件内容。 Mail successfully sends to iPhone but the content they receive is in an uneven format.
邮件成功发送到iPhone,但他们收到的内容格式不正确。
Exampe: My Content 例子:我的内容
Username:siddesh
Date:2013-06-20 04:46:40
Email:siddesh@bhalke.com
Type:seller
File Name:xlsfile
File Type:xls
Uploaded By:primary User
Download :[download]
My Code: 我的代码:
<p>Username:<?php echo htmlspecialchars($username);?></p>
<p>Date:<?php echo htmlspecialchars($date);?></p>
<p>Email:<?php echo htmlspecialchars($email);?></p>
<p>Type:<?php echo htmlspecialchars($type);?></p>
<p>File Name:<?php echo htmlspecialchars($file_name);?></p>
<p>File Type:<?php echo htmlspecialchars($file_type);?></p>
<p>Uploaded By:<?php echo htmlspecialchars($uploaded_by);?></p>
<p><a href="<?php echo 'http://www.test.com/files/'.$uid.'/'.$file_name.'.'.$file_type;?>">Download</a></p><br/>
Should receive Format: 应该收到格式:
Username:siddesh
Date:2013-06-20 04:46:40
Email:siddesh@bhalke.com
Type:seller
File Name:xlsfile
File Type:xls
Uploaded By:primary User
Download :[download]
But It received Format on iPhone as: SUBJ:test-failed file 但它收到iPhone上的格式为:SUBJ:测试失败的文件
MSG:¿¿¿¿¿¿
(Con't) 2 of 6
(Con't) 3 of 6
Username:Rajesh:2013-06-17
10:05:14Email:sid@r
(Con't) 4 of 6
mygroup.comType:MyFile
Name:simple Type:xlsUploaded By:Sid blk
ConnectionThank
(Con't) 5 of 6
You,test.com
A¿ Copyright
2013 by test. All Right Reserved.
info@test.com
www.test.com
Send Mail Function..! 发送邮件功能..!
function sendMail($template = null, $to_email = null, $from_email = null, $subject = null, $contents = array()) {
$from_email = Configure::read('site.support_email');
$bcc_email = Configure::read('site.developers_email');
$email = new CakeEmail();
$result = $email->template($template, 'default')
->emailFormat('html')
->to($to_email)
->bcc($bcc_email)
->from($from_email)
->subject($subject)
->viewVars($contents);
if ($email->send('default')) {
$this->log('email to : ' .$to_email. 'Subject : ' .$subject);
return true;
}
return false;
}
To send the above format data, I have used normal p
and br
tags but the data showing on iPhone is not in a proper format and few unnecessary data is sent with it. 要发送上述格式数据,我使用了普通的
p
和br
标签,但iPhone上显示的数据格式不正确,并且很少发送不必要的数据。
Can anybody help me with this? 任何人都可以帮我吗?
Send the mail as HTML, instead of text like this: 将邮件发送为HTML,而不是像这样的文本:
//Send as 'html', 'text' or 'both' (default is 'text')
$this->Email->sendAs = 'both';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.