A
A
Anton2016-08-01 14:11:27
Laravel
Anton, 2016-08-01 14:11:27

How to properly use sending emails on Laravel?

Good afternoon!
I decided to use Laravel tools to send emails to e-mail using SMTP. But I've run into a problem that I can't solve.
Email sending code:

$subject = ($act == 0) ? trans('backend/users.activation_off_subject') : trans('backend/users.activation_on_subject');
$message = ($act == 0) ? trans('backend/users.activation_off_message') : trans('backend/users.activation_on_message');
$from = Settings::first()->email;
$mail = $user->email;

Mail::raw($message, function($mess) use ($from, $mail, $subject) {
    $mess->from($from, 'Test');
    $mess->to($mail)->subject($subject);
});

But this error pops up:
Whoops, looks like something went wrong.
Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 220 but got code 503, with message 503 Bad sequence of commands

The SMTP settings must be correct, as they told me in support.
Tell me, please, what is the problem and how to solve it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2016-08-01
@Yadalay

Problem solved.
You need to comment out the line in config/mail.php'encryption' => env('MAIL_ENCRYPTION', 'tls'),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question