laravel4 hotmail 和 microsoft live 无法发送邮件

laravel4 can not sending mail in hotmail and microsoft live

我可以在yahoo,gmail邮件服务器发送用户注册确认邮件但是我不能在hotmail和microsoft live邮件服务器发送邮件

这是我的 mail.php 文件:

  <?php

  return array(

/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"
|
*/

'driver' => 'smtp',

/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/

'host' => 'mail.needagroup.com',

/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/

'port' => 465,

/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/

'from' => array('address' => 'needagro@needagroup.com', 'name' => 'Needa'),

/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/

'encryption' => 'ssl',

/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/

'username' => 'needagro',

/*
|--------------------------------------------------------------------------
| SMTP Server Password
|--------------------------------------------------------------------------
|
| Here you may set the password required by your SMTP server to send out
| messages from your application. This will be given to the server on
| connection so that the application will be able to send messages.
|
*/

'password' => '***************',

/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/

'sendmail' => '/usr/sbin/sendmail',

/*
|--------------------------------------------------------------------------
| Mail "Pretend"
|--------------------------------------------------------------------------
|
| When this option is enabled, e-mail will not actually be sent over the
| web and will instead be written to your application's logs files so
| you may inspect the message. This is great for local development.
|
*/

'pretend' => false,

);

我的代码有什么问题,是否缺少任何配置?不能只发邮件到hotmail和microsoft live mail服务器真的很奇怪

UPDATE: 测试注册后,我收到了"We have sent account confirmation email to your email address"的确认信息,但是我的hotmail或microsoft live里没有邮件,甚至在垃圾邮件文件夹。

由于您能够成功地将一些电子邮件发送给某些提供商,问题显然不在您的代码或 Laravel 中。

一些电子邮件服务已经为传入邮件实施了各种安全和反垃圾邮件策略,其中一些可能会过滤来自您服务器的传入邮件。你可以做什么:

  1. 检查您的服务器日志。如果 Microsoft 拒绝从您的服务器发送邮件,日志应该有一个 return 说明原因的收据。
  2. 检查您的服务器和 DNS 配置。您可以使用像 http://mxtoolbox.com 这样的工具来快速扫描潜在问题

在您的特定情况下,对 mail.needagroup.com 的扫描揭示了以下问题:

Reverse DNS FAILED! This is a problem.

No SPF records found 

这些确实是问题。具体来说,反向 DNS 查找已成为一种常见的反垃圾邮件方法,如果失败,世界上许多服务器将不会发送电子邮件。

我希望这至少能给你一个起点!