小编Man*_*uel的帖子

PHPMailer Mailer错误:消息正文为空

我正在尝试使用PHPMailer的基本示例.

我所做的只是上传整个PHPMailer_5.2.2文件夹,按照你看到的代码配置下面的页面,我不断得到Mailer Error: Message body empty,但我可以清楚地看到contents.html文件中有html并且不是空的.这是我在PHPMailer中使用的示例文件PHPMailer_5.2.2/examples/test_smtp_gmail_basic.php

我尝试使用我在Outlook for Gmail中运行的设置,我知道我的用户名和密码,SMTP端口是587并且它设置为TLS,我尝试在下面的代码中用TLS替换SSL,我仍然得到相同的错误.

我也尝试了以下代码,有人建议:

改变了这个:

$mail->MsgHTML($body);
Run Code Online (Sandbox Code Playgroud)

对此

$mail->body = $body;
Run Code Online (Sandbox Code Playgroud)

我仍然有同样的错误,还有其他我需要配置的东西吗?这是我第一次使用PHPMailer,我可以获得标准的php邮件,但我想尝试这个,因为我要发送电子邮件的页面有很多HTML,我不想要通过所有的HTML并输入字符转义,以便有人推荐使用此功能.

<?php

//error_reporting(E_ALL);
error_reporting(E_STRICT);

date_default_timezone_set('America/Toronto');

require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

$body             = file_get_contents('contents.html');
$body             = preg_replace('/[\]/','',$body);

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages …
Run Code Online (Sandbox Code Playgroud)

php email phpmailer

3
推荐指数
2
解决办法
3万
查看次数

从学说地理记录中的给定坐标获取距离

我正在开发一个Symfony 1.4项目,其中一个表格具有地理模板.当前函数可以给出两个记录之间的距离,但不能给出记录和给定坐标之间的距离.

如何以Symfony的方式实现这样的功能?

更具体:我需要按照给定纬度和经度坐标的下降距离排序的记录

谢谢大家!

php doctrine symfony1

2
推荐指数
1
解决办法
3653
查看次数

标签 统计

php ×2

doctrine ×1

email ×1

phpmailer ×1

symfony1 ×1