2017-12-28 5 views
2

So habe ich die Anleitung, gefolgt, wie eine E-Mail mit laravel einzurichten und amazon simple mail serviceLaravel amazon ses gibt Swift_TransportException

in meinem mail.php

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

und dies ist meine Mail-Klasse:

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, 
      ]); 
    } 
} 

Wenn ich versuche, eine Mail zu senden, bekomme ich Folgendes:

enter image description here

Kann mir jemand sagen, was ich vermisse?

Mein 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'), 
     ], 
    ], 

]; 

Meine .env Datei:

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=**** 
+0

Haben Sie auch 'secret' und' region' für den Treiber in 'mail.php' eingeschlossen? Auch in deiner '.env' Datei hast du eine Variable mit dem Namen' ses' und der Wert ist 'ses'? – user3158900

+0

habe ich die Schlüssel und Werte in der .env: SES_KEY = **** SES_SECRET = ***** –

+0

Sie nur E-Mails an eine SES-Adresse im Entwicklungsmodus überprüft E-Mail senden können –

Antwort

1

Es Sie ses müssen, geben Sie Ihre MAIL_DRIVER Variable in Ihrer .env Datei angezeigt wird, dann Ändern Sie Ihre mail.php so, dass sie übereinstimmt ...

Ersetzen Sie

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

Mit

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

Das Problem, das ich vermute, ist env('ses', 'smtp') wird ses nicht zurückkehren, wird es für eine Variable in Ihrer .env Datei aussehen ses benannt und dessen Wert zurück.

+0

Die Sache sagen, man sollte sein in meiner mail.php soll das nicht in meine services.php gehen? –

+0

Ah ja, meine Entschuldigung, ich habe die Dokumentation falsch gelesen. – user3158900

+0

Ich habe versucht, das mit Ihrem Treiber jedoch ohne Glück zu tun –