laravel4无法在hotmail和microsoft live中发送邮件

时间:2015-03-30 01:12:11

标签: php email laravel-4 hotmail

我已经能够在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邮件服务器。

更新:在测试注册后,我收到了确认消息&#34;我们已将帐户确认电子邮件发送到您的电子邮件地址&#34;,但我的Hotmail中没有电子邮件或microsoft live,甚至不在垃圾邮件或垃圾邮件文件夹中。

1 个答案:

答案 0 :(得分:1)

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

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

  1. 检查服务器日志。如果Microsoft拒绝从您的服务器发送邮件,则日志应该有一个返回收据,说明原因。
  2. 检查您的服务器和DNS配置。您可以使用http://mxtoolbox.com等工具快速扫描潜在问题
  3. 在您的特定情况下,mail.needagroup.com扫描会发现以下问题:

    Reverse DNS FAILED! This is a problem.
    
    No SPF records found 
    

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

    我希望这至少可以让你在某个地方开始!