Jump to content

error 500 after setup mail setting using aws ses


lg2975luca

Recommended Posts

hi,

i receive error 500 on reset password page after setting up email on env.php using aws ses, this is the env file :

 

MAIL_MAILER=postmark
AWS_ACCESS_KEY_ID='mykey'
AWS_SECRET_ACCESS_KEY='mykey'
AWS_DEFAULT_REGION=ap-southeast-1

 

in the log file i find this

[2022-12-30 13:09:30] production.ERROR: Class "Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory" not found {"exception":"[object] (Error(code: 0): Class \"Symfony\\Component\\Mailer\\Bridge\\Postmark\\Transport\\PostmarkTransportFactory\" not found at /home/lg2975luca/phpvms/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php:299) [stacktrace]

 

any help will be appreciated!

regards 

 

Link to comment
Share on other sites

I do not think postmark is/was available in core v7 by default... You may need to follow Laravel Docs to have it installed first and then configure it as needed. Only then the MAIL_MAILER=postmark can work.

 

https://laravel.com/docs/9.x/mail#postmark-driver

 

Hope this helps

 

PS: If you are not using a VPS (or have shell/command line access to your shared hosting), you may not be able to run composer and install/update packages easily.

 

 

Edited by DisposableHero
Link to comment
Share on other sites

installed driver for postmark and ses using composer require symfony/mailgun-mailer symfony/http-client and composer require aws/aws-sdk-php , cheched the configuration on

mail.php  :

eturn [ 'default' => env('MAIL_MAILER', 'smtp'), 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, ], 'ses' => [ 'transport' => 'ses', ], 'mailgun' => [ 'transport' => 'mailgun', ], 'postmark' => [ 'transport' => 'postmark', ], 'sendmail' => [ 'transport' => 'sendmail', 'path' => '/usr/sbin/sendmail -bs', ], 'log' => [ 'transport' => 'log', 'channel' => env('MAIL_LOG_CHANNEL', 'stack'), ],

 

and services.php : 

 'mailgun' => [
        'domain'   => env('MAILGUN_DOMAIN'),
        'secret'   => env('MAILGUN_SECRET'),
        'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
    ],

    'postmark' => [
        'token' => env('POSTMARK_TOKEN'),
    ],

    'ses' => [
        'key'    => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],
];
 

but received the same error 500 afthere requiring password recovery, in log file i can see this :  

 

[2022-12-31 08:28:33] production.ERROR: Class "Aws\Ses\SesClient" not found {"exception":"[object] (Error(code: 0): Class \"Aws\\Ses\\SesClient\" not found at /home/lg2975luca/phpvms/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php:239)

cheching the mailmanager i find this section  from 222 to 257 lines :

 

 

  /**
     * Create an instance of the Symfony Amazon SES Transport driver.
     *
     * @param  array  $config
     * @return \Symfony\Component\Mailer\Bridge\Amazon\Transport\SesApiAsyncAwsTransport
     */
    protected function createSesTransport(array $config)
    {
        $config = array_merge(
            $this->app['config']->get('services.ses', []),
            ['version' => 'latest', 'service' => 'email'],
            $config
        );

        $config = Arr::except($config, ['transport']);

        return new SesTransport(
            new SesClient($this->addSesCredentials($config)),
            $config['options'] ?? []
        );
    }

    /**
     * Add the SES credentials to the configuration array.
     *
     * @param  array  $config
     * @return array
     */
    protected function addSesCredentials(array $config)
    {
        if (! empty($config['key']) && ! empty($config['secret'])) {
            $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
        }

        return $config;
    }

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...