0

I've got an error

Swift_TransportException in StreamBuffer.php line 265: Connection could not be established with host mailtrap.io [ #0]

May know what's the meaning of this? Glad that you could help me. thank you ^^

4
  • which client are you using to send a verification email? May be adding your config/mail.php code and ..env content will be helpful. Commented Dec 10, 2015 at 5:33
  • I aready set my mail.php and .env but it's the same result T__T Commented Dec 10, 2015 at 7:45
  • If you use the same credentials to trigger email in some smtp program, does the mail gets delivered without any error ? This is to make sure that your credentials is right.. Commented Dec 10, 2015 at 8:49
  • unfortunately no... T__T it didn't delivered to the email... Commented Dec 10, 2015 at 9:01

2 Answers 2

1

Mailing configuration can been seen at 2 places:

  1. .env file
  2. mail.php file located in config folder

You can update either of them, but it is strictly recommended to edit the .env file so as to avoid touching the default configurations.

Open .env file. You will see the mail configs in the bottom like so:

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Now, login to your mailtrap.io account. From the Integrations dropdown, you need to select the Laravel option. When selected, the configs are provided below like this:

return array(
  "driver" => "smtp",
  "host" => "mailtrap.io",
  "port" => 2525,
  "from" => array(
      "address" => "[email protected]",
      "name" => "Example"
  ),
  "username" => "your_username",
  "password" => "your_password",
  "sendmail" => "/usr/sbin/sendmail -bs",
  "pretend" => false
);

Now open the mail.php file:

Go down to line number 57, it should have 'from' => ['address' => null, 'name' => null],. You need to replace this with what is provided in the mailtrap.io config.

So the updated from should be 'from' => ['address' => '[email protected]', 'name' => 'Example'],.

Now, in your .env file, update the MAIL_USERNAME and MAIL_PASSWORD with the your_username and your_password respectively.

So, your mailing config in .env file should like:

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=null

Done. You should now see the mails functioning without any further issues. Hope this helps you out.

Cheers.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to to set mailing provider details in .env file or you can add in config/mail.php

.env

MAIL_DRIVER=mail
MAIL_HOST=smtp.mandrillapp.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=test pass
[email protected]
MAIL_NAME=test
MAIL_ENCRYPTION=null

1 Comment

Please check this article... laracasts.com/discuss/channels/laravel/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.