I am using PepiPost mail service for sending an email. PepiPost mail service provides an SDK for send sending mail. They provided a sample code for sending mail.
When I send the mail getting the following error message:
Unable to send e-mail. Contact the site administrator if the problem persists.
But mail is sent to the corresponding user and user can receive the mail.
I have created a Custom mail system call by implementing
MailSystemInterface. The code is available in the here. Although this is the code I placed in mail()
function.
class TestMailSystem implements MailSystemInterface {
require_once __DIR__.'/includes/vendor/autoload.php';
use PepipostAPIV10Lib\Controllers\Email;
public function format(array $message) {
// Join message array.
$message['body'] = implode("\n\n", $message['body']);
return $message;
}
public function mail(array $message) {
$email = new Email();
$data = array(
'api_key' => '************',
'recipients' => $message['to'],
'email_details' => array(
'from' => $message['from'],
'subject' => $message['subject'],
'content' => $message['body'],
'fromname' => $message['fromname'],
'tags' => 'test',
'replytoid' => $replyto,
),
'X-APIHEADER' => array('UserID1','UserID2'),
'settings' => array(
'footer' => true,
'clicktrack' => true,
'opentrack' => true,
),
$response = $email->sendJson( $data );
}
}
When I send the mail getting the following error message:
Unable to send e-mail. Contact the site administrator if the problem persists.
User receives the email. What would the reason for the error message be?