• Hello,

    In the new version, scheduled emails should be possible – that’s exactly what I need.
    But I can’t find any documentation. Can you give an example on how it works?

    Is there also a way to cancel the scheduled email if a certain function is called before the sending of the mail?

    Thank you

    https://www.ads-software.com/plugins/wpmandrill/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Heya!

    I was able to get it working with the following code:

    $message = array(
    			'subject' => $subject,
    			'from_name' => $author_name,
    			'from_email' => $author_email,
    			'to' => $to,
    			'html' => $content,
    			'send_at' => '2015-10-06 23:30:00'
    		);
    
    		$sendmessage = wpMandrill::sendEmail(
    			$message
    		);

    where send_at is the UTC time for when the message should be delivered

    Also, if you need to cancel.. the return value for $sendmessage in my example above will give you a message ID for which you could use to cancel/reschedule via the Mandrill API

    Thread Starter mattmatt88

    (@mattmatt88)

    Thanks a lot, got it working!

    Would you mind giving an example to cancel the email?
    I’m not the best coder.

    haven’t tested this, but i’d do something like this:

    $url = 'https://mandrillapp.com/api/1.0/messages/cancel-scheduled.json';
    $key = 'YOUR API KEY';
    $message_id;  // this would be your message id from the previous call in my example above. 
    
    $args = array(
    	'body' => array(
    		'key' => $key,
    		'id' => $message_id,
    	)
    );
    
    $results =  wp_remote_post( $url, $args );
    $results = json_decode($results['body']);
    var_dump($results); // use this to debug or get results
    Thread Starter mattmatt88

    (@mattmatt88)

    that WORKS.
    Thank you very much!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Schedule Emails – How to?’ is closed to new replies.