3

So i have followed the guide on how to set up a mail with laravel and amazon simple mail service

in my mail.php

 'driver' => env('ses', 'smtp'), 

and this is my mail class:

namespace App\Mail; use App\rental_request; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; class AccountDetails extends Mailable { use Queueable, SerializesModels; protected $user; /** * Create a new message instance. * * @return void */ public function __construct($user) { $this->user = $user; } /** * Build the message. * * @return $this */ public function build() { return $this->view('mail.accountdetails') ->with([ 'password' => $this->user->password, 'name' => $this->user->username, ]); } } 

When I attempt to send a mail I get the following:

enter image description here

Can anyone tell me what I'm missing?

My mail.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('ses', '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' => 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', '[email protected]'), 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* |-------------------------------------------------------------------------- | 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('MAIL_USERNAME'), 'password' => env('MAIL_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 -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'), ], ], ]; 

My .Env file:

 APP_NAME=***** APP_ENV=local APP_KEY=base64:S3RvGYDc4ApvYauVV8Q6haaX2cFC0wWneGFSoP1z2BQ= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=**** DB_USERNAME=**** DB_PASSWORD=**** BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379php MAIL_DRIVER=ses MAIL_HOST=email-smtp.eu-west-1.amazonaws.com MAIL_PORT=25 MAIL_USERNAME=info MAIL_PASSWORD=*** MAIL_ENCRYPTION=null PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 SES_KEY=**** SES_SECRET=**** 
3
  • Did you also include the secret and region for the driver in mail.php? Also in your .env file, you have a variable named ses and it's value is ses? Commented Dec 28, 2017 at 15:15
  • i set the key and values in the .env: SES_KEY=**** SES_SECRET=***** Commented Dec 28, 2017 at 15:20
  • you can only send emails to a SES verified email address in development mode Commented Dec 28, 2017 at 16:03

1 Answer 1

2

It appears you need to set your MAIL_DRIVER variable in your .env file to ses, then change your mail.php to match...

Replace

'driver' => env('ses', 'smtp'), 

With

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

The problem I suspect is env('ses', 'smtp') will not return ses, it will look in your .env file for a variable named ses and return its value.

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

3 Comments

The thing you say should be in my mail.php isnt that suppose to go into my services.php?
ive attempted to do that with your driver however without any luck
ive added my env file to the question

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.