Php Laravel 5.3-SwiftMailer错误:503身份验证优先(#5.5.1)

Php Laravel 5.3-SwiftMailer错误:503身份验证优先(#5.5.1),php,laravel,email,smtp,swiftmailer,Php,Laravel,Email,Smtp,Swiftmailer,我正在尝试通过SMTP发送电子邮件(无身份验证)。 以下是我的.env设置: MAIL_DRIVER=smtp MAIL_HOST=localhost MAIL_PORT=587 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=tls 正如您所见,我的邮件服务器不需要使用tls加密进行身份验证,并且在同一台服务器上,通过PHPMailer(没有Laravel),我可以正确发送电子邮件。事实是,当我尝试通过Laravel发送邮件(使用可

我正在尝试通过SMTP发送电子邮件(无身份验证)。 以下是我的
.env
设置:

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=tls
正如您所见,我的邮件服务器不需要使用tls加密进行身份验证,并且在同一台服务器上,通过
PHPMailer
(没有Laravel),我可以正确发送电子邮件。事实是,当我尝试通过Laravel发送邮件(使用
可邮寄的
)时,我收到以下错误:

Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "503", with message "503 AUTH first (#5.5.1)
"
我尝试使用空用户名和密码、ssl加密、不加密、不同端口。。我就是无法通过拉威尔发送电子邮件

在这里,您可以看到my mailable的构造和构建方法:

public $customerName;
public $customerEmail;
public $emailSubject;
public $emailMessage;


public function __construct($customerName, $customerEmail, $emailSubject, $emailMessage)
    {
        $this->customerName = $customerName;
        $this->customerEmail = $customerEmail;
        $this->emailSubject = $emailSubject;
        $this->emailMessage = $emailMessage;
    }


public function build()
    {
        return $this->view('emails.send');
    }
我是不是错过了什么/做错了什么?我似乎找不到解决这个问题的办法


提前谢谢大家。

您可以发送电子邮件而无需验证,以下是我在
config/mail.php
中使用的配置,效果很好

<?php

return [

/*
|--------------------------------------------------------------------------
| 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", "sendmail", "mailgun", "mandrill", "ses",
|            "sparkpost", "log", "array"
|
*/

'driver' => env('MAIL_DRIVER', 'sendmail'),

/*
|--------------------------------------------------------------------------
| 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' => env('MAIL_HOST', 'smtp.mailgun.org'),

/*
|--------------------------------------------------------------------------
| 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' => env('MAIL_PORT', 587),

/*
|--------------------------------------------------------------------------
| 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' => [
    'address' => env('MAIL_FROM_ADDRESS', 'noreply@something.com'),
    'name' => env('MAIL_FROM_NAME', 'Whatever'),
],

/*
|--------------------------------------------------------------------------
| 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' => env('MAIL_ENCRYPTION', 'tls'),

/*
|--------------------------------------------------------------------------
| 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' => env(null),

'password' => env(null),

/*
|--------------------------------------------------------------------------
| 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 -bs',

/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/

'markdown' => [
    'theme' => 'default',

    'paths' => [
        resource_path('views/vendor/mail'),
    ],
],

];

如果没有身份验证,您无法发送电子邮件,请尝试提供用户名和密码。我发现您正在使用mailgun发送电子邮件。我们有我们的邮件服务与。。顺便说一句,我们的配置基本相同,不明白为什么我不能在没有身份验证的情况下发送。。
$userArr = array();    
Mail::send('mail.yourviewname', $userArr, function($message) use ($userArr) {
                $message->bcc('someone@something.com', 'Someone');
                $message->to($userArr['email'] ,  $userArr['name'])->subject('Blah blah');
                $message->from('noreply@something.com','Whatever');
            });