M
M
Maybe_V2016-06-20 13:55:59
PHP
Maybe_V, 2016-06-20 13:55:59

How to send an email using Mandrill?

You need to send an email using Mandrill.
I do it like this:

require_once 'mandrill-api/src/Mandrill.php';

$mandrill = new Mandrill('Smd-g2j7RNpaiq0L00EYNQ');

$mail = array(
    'subject' => 'Some Theme',
    'from_email' => '[email protected]',
    'from_name' => 'FromName',
    'html' => '<h1>Hello</h1>',
    'to' => array(array('email' => '[email protected]', 'name' => 'ToName', 'type' => 'to')));

try {
    $res = $mandrill->messages->send($mail);
    print_r($res);
    
} catch(Mandrill_Error $error) {
    echo 'Error: ' . get_class($error) . ' - ' . $error->getMessage();
}

But as a result, it shows that the send was rejected:
Array ( [0] => Array ( [email] => [email protected] [status] => rejected [_id] => 059dec07fd8243c69c60a0133f5a8ee9 [reject_reason] => unsigned ) )


How to do it right? What did I miss?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akelsey, 2016-06-20
@akelsey

From here :
This means that the message from the server from which you are trying to send on behalf of gmail.com - cannot be sent, because. SPF for the Google domain probably does not have your IP address.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question