I'm getting "Internal Server Error 500" after the third or sometimes at the first attempt to send a mail using CakePHP 3 through AWS SES account (in production mode) running on Hiawatha server.
Here is my php code:
public function sendmail()
{
$email = new Email();
$email->transport('SES');
try {
$res = $email->from(['account@example.com' => 'Name'])
->to(['receiver@hotmail.com' => 'Receiver'])
->subject('Test mail')
->send('some text');
} catch (Exception $e) {
$this->Flash->error('Error. Please, try again.');
echo 'Exception : ', $e->getMessage(), "\n";
return $this->redirect('/');
}
$this->Flash->success('Ok. You will receive a confirmation mail');
return $this->redirect('/');}
Here is the transport configuration
'EmailTransport' => [
'SES' => [
'host' => 'email-smtp.eu-west-1.amazonaws.com',
'port' => 25,
'timeout' => 60,
'username' => 'ASDFASADQWE',
'password' => 'FSDFDSFDSFSEREWRWERWER',
'tls' => true,
'className' => 'Smtp'
],
port 465 and 587 are not working at the first attemp
So, basically I can't identify if the problem came from CakePHP, AWS SES or some configuration on the server.
Thank you for any recommendation.