Kohana错误发送电子邮件试图避免垃圾邮件过滤器

时间:2014-05-07 09:57:56

标签: php email kohana spam-prevention

我们的网站使用Kohana框架以PHP构建。

我们在向Kohana发送电子邮件时遇到垃圾邮件问题,因此我们正在尝试使用垃圾邮件编辑来编辑我们的代码。

我们现在遇到的问题是Kohana错误,内容如下:

Exception
system/vendor/swift/Swift.php [345]:
The sender parameter must either be a valid string email address or an instance of Swift_Address.

这是我们的旧代码:

/*
 * E-mail sender
 */
$swift = email::connect();
$email_message = new View('email/email_template');
$subject = "This is our subject";
$from = "subdomain@domain.org";

这是我们想要实现的新代码:

/*
 * E-mail sender
 */
$swift = email::connect();
$email_message = new View('email/email_template');
$subject = "This is our subject";
/*$from = "subdomain@domain.org";*/

//Avoiding SPAM filters
$header = "";
$from = $header;
$header .= "Reply-To: ". $user->firstname . " " . $user->lastname ." <". $user->email .">\r\n"; 
$header .= "Return-Path: ". $user->firstname . " " . $user->lastname ." <". $user->firstname . "@realFromAccordingToGoogle.org>\r\n"; 
$header .= "From: ". $user->firstname . " " . $user->name ." <subdomain.domain@realFromAccordingToGoogle.org>\r\n"; 
$header .= "Organization: Our Company\r\n"; 
$header .= "Content-Type: text/html\r\n";

有谁知道如何正确编写此代码并使其与Kohana框架一起使用。

先谢谢。

0 个答案:

没有答案