I am using PepiPost mail service and I created custom mail system class for integrating PepiPost service. I can successfully send email from Drupal site. If a connection timeout 504 occurs during email sending process, email is not triggered how can I handle this scenairo. This is the code I used for email sending
class CustomMailSystem implements MailSystemInterface {
public function format(array $message) {
// Join message array.
$message['body'] = implode("\n\n", $message['body']);
return $message;
}
/**
* Implement mail method to send mail via Sendgrid.
*
* @param array $message
* @return bool
*/
public function mail(array $message) {
$email = new Email();
$data = array(
'api_key' => '****************',
'recipients' => $to
'email_details' => array(
'from' => $from,
'subject' => $subject,
'content' => $body,
),
try {
$response = $email->sendJson( $data );
catch(Exception $e){
print 'Call failed due to unhandled exception/error('. $e->getMessage().')'."\n";
}
}
}