php - Internal Server Error 500 when sending mail to AWS SES with cakephp running on Hiawatha -


i'm getting "internal server error 500" after third or @ first attempt send mail using cakephp 3 through aws ses account (in production mode) running on hiawatha server.

here 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. receive confirmation mail');     return $this->redirect('/');}  

here 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 , 587 not working @ first attemp

so, can't identify if problem came cakephp, aws ses or configuration on server.

thank recommendation.

at end stop use cakephp mail , setup phpmailer, difficulties use compose , make run, @ end working code can send many mails in row.

   public function sendmailphpmailer()     {       $mail = new \phpmailer();       $mail->issmtp();                                             $mail->host = 'email-smtp.eu-west-1.amazonaws.com';         $mail->smtpauth = true;                                     $mail->username = 'username';        $mail->password = 'password';       $mail->smtpsecure = 'tls';           $mail->port = 587;                                      $mail->from = 'mail@mail.com';       $mail->fromname = 'cakephp phpmailer';       $mail->addaddress('tomail@mail.com', 'receiver');       $mail->ishtml(true);                                      $mail->subject = 'test using phpmailer & ses';       $mail->body    = 'this html message body <b>in bold!</b>';       $mail->altbody = 'this body in plain text';        if(!$mail->send()) {           $this->flash->error('error');           echo 'exception : ',  $mail->errorinfo, "\n";           return $this->redirect('/');         }else{           $this->flash->success('ok');           return $this->redirect('/');         }     } 

and code can send 3 mails interval of 1s receive error 500.

    public function sendmail()     {         $email = new email();         $email->transport('ses');         try {             $res = $email->from(['mail@mail.com' => 'cakephp mail'])                   ->to(['tomail@mail.com' => 'receiver'])                   ->subject('cakephp & ses')                   ->send('message via cakephp , ses');         } catch (exception $e) {             $this->flash->error('error');             echo 'exception : ',  $e->getmessage(), "\n";             return $this->redirect('/');         }         $this->flash->success('ok');         return $this->redirect('/'); } 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -