I'm trying to send an email via SMTP (Without Authentication). Here's my .env
settings:
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=tls
My mail server needs, as you can see, no authentication with tls encryption, and on the same server, via PHPMailer
(Without Laravel), I can correctly send e-mails. Fact is that, when I try to send a mail via Laravel (Using a mailable
), I receive the following error:
Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "503", with message "503 AUTH first (#5.5.1)
"
I tried with empty username and password, ssl encryption, no encryption, different ports.. I just can't manage to send an e-mail via Laravel.
Here you can see my mailable's construct and build methods:
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');
}
Am I missing something / doing something wrong? I can't seem to find a solution for this..
Thank you all in advance.
via Michael Di Prisco