2017-07-26 21 views
0

初めてAmazon SESをセットアップしています。 Laravelのウェブサイトの文書に続いて、私はパッケージをインストールし、メールを設定し始めました。LaravelとAmazon SES

mail.php

<?php 

return [ 
    'driver' => env('MAIL_DRIVER', 'ses'), 
    'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 
    'port' => env('MAIL_PORT', 587), 
    'from' => [ 
     'address' => env('MAIL_FROM_ADDRESS', '[email protected]'), 
     'name' => env('MAIL_FROM_NAME', 'Example'), 
    ], 
    'encryption' => env('MAIL_ENCRYPTION', 'tls'), 
    'username' => env('MAIL_USERNAME'), 
    'password' => env('MAIL_PASSWORD'), 
    'sendmail' => '/usr/sbin/sendmail -bs', 
    'markdown' => [ 
     'theme' => 'default', 

     'paths' => [ 
      resource_path('views/vendor/mail'), 
     ], 
    ], 

]; 

services.php

'ses' => [ 
     'key' => env('SES_KEY'), 
     'secret' => env('SES_SECRET'), 
     'region' => 'eu-west-1', 
    ], 

.env

MAIL_DRIVER=ses 
SES_KEY=ASKFKGDRJ3 
SES_SECRET=kdfsjjdsfjdfsjdfsj 
MAIL_HOST=email.eu-west-1.amazonaws.com 
MAIL_PORT=587 
MAIL_USERNAME=null 
MAIL_PASSWORD=null 
MAIL_ENCRYPTION=null 

メール/ WelcomeEmail.php

<?php 

namespace App\Mail; 

use Illuminate\Bus\Queueable; 
use Illuminate\Mail\Mailable; 
use Illuminate\Queue\SerializesModels; 
use Illuminate\Contracts\Queue\ShouldQueue; 

class WelcomeEmail extends Mailable 
{ 
    use Queueable, SerializesModels; 

    /** 
    * Create a new message instance. 
    * 
    * @return void 
    */ 
    public function __construct() 
    { 
     // 
    } 

    /** 
    * Build the message. 
    * 
    * @return $this 
    */ 
    public function build() 
    { 
     return $this->from('[email protected]') 
        ->view('emails.welcomeEmail'); 
    } 
} 

welcomeEmail.blade.php

<p>This is a test email from test email address, let me know on slack if you receive it</p> 

コントローラー:

public function map(Request $request) 
{ 
    Mail::to($request->user())->send(new WelcomeEmail()); 
    return view('profile.map'); 
} 

とエラー:しかし、私はSES_keyと秘密が正しいことを確信している

Error executing "SendRawEmail" on "https://email.eu-west-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://email.eu-west-1.amazonaws.com` resulted in a `403 Forbidden` response: 
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> 
<Error> 
<Type>Sender</Type> 
<Code>SignatureDo (truncated...) 
SignatureDoesNotMatch (client): The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. 

The Canonical String for this request should have been 
'POST 
/

aws-sdk-invocation-id:7a73507566587348bba7c543661be161 
aws-sdk-retry:0/0 
host:email.eu-west-1.amazonaws.com 
x-amz-date:20170726T195108Z 

aws-sdk-invocation-id;aws-sdk-retry;host;x-amz-date 
7a1f353a7f93f014d66ee19fb4b9661a79fea8411d1f97af2799c0cc04dc57dc' 

The String-to-Sign should have been 
'AWS4-HMAC-SHA256 
20170726T195108Z 
20170726/eu-west-1/ses/aws4_request 
c2422180627319d05721ed6a2dc3973f7a508c34e4b2f9699d0a7bbf0c56d6a8' 
- <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> 
<Error> 
<Type>Sender</Type> 
<Code>SignatureDoesNotMatch</Code> 
<Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. 

The Canonical String for this request should have been 
'POST 
/

aws-sdk-invocation-id:7a73507566587348bba7c543661be161 
aws-sdk-retry:0/0 
host:email.eu-west-1.amazonaws.com 
x-amz-date:20170726T195108Z 

aws-sdk-invocation-id;aws-sdk-retry;host;x-amz-date 
7a1f353a7f93f014d66ee19fb4b9661a79fea8411d1f97af2799c0cc04dc57dc' 

The String-to-Sign should have been 
'AWS4-HMAC-SHA256 
20170726T195108Z 
20170726/eu-west-1/ses/aws4_request 
c2422180627319d05721ed6a2dc3973f7a508c34e4b2f9699d0a7bbf0c56d6a8' 
</Message> 
</Error> 
<RequestId>c458f296-723b-11e7-a686-515a08ffcc2f</RequestId> 
</ErrorResponse> 

、ドメインを検証し、電子メールも、私は何が欠けていますか?

+0

に移動する必要が検証さを意味し、日付/時刻です実際の時間の約1分以内に正確にあなたのサーバー上で? – ceejayoz

+0

はい、送信しているメールが確認されていないとは言えません。 FROM電子メールは検証されていますが、TOはそうではありません。私は誰にでも電子メールを送信できるようにするためには意味がありません –

答えて

0

Yes, it not says that the email I am sending to is not verified?

これはSES "サンドボックス" にしていることを意味します。開発中に

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html

: - ちょうどhttps://aws.amazon.com/ses/extendedaccessrequest/でフォームに必要事項を記入

  • You can only send mail to the Amazon SES mailbox simulator and to verified email addresses and domains.
  • You can only send mail from verified email addresses and domains.
  • You can send a maximum of 200 messages per 24-hour period.
  • Amazon SES can accept a maximum of one message from your account per second.

(あなたは誰にもメールを送信することができます)生産にサンドボックスからの移行は十分に簡単です。

0

それはだことはあなたのサンドボックスモードとサンドボックスモードでは、唯一の生産にサンドボックスから移動したり、テストメールのメールを確認するのいずれかのように、電子メールがmaildを取得しますが、最後に、あなたが生産

関連する問題