使用 wpMandrill 将电子邮件安排到 Wordpress
Schedule email using wpMandrill to Wordpress
是否可以使用 wpMandrill 插件安排消息?
我看到了这个post that we can use mandrill_payload filter to change anything in the structure (following Mandrill's API , /messages/send).
如何更改 send_at 参数以便我可以安排要发送的电子邮件。
会不会是这样的:
function customFilterSendAt($send_at)
{
$send_at = "2016-01-23 14:00:00";
return $send_at;
}
add_filter('mandrill_payload', 'customFilterSendAt');
然后
wp_mail($email_adress, $subj, $body );
?
我发现可以使用 wpMandrill 安排电子邮件。 link(查看 aaroneight 评论)对我有帮助。
要使用 wpMandrill 安排您的电子邮件:
$message = array(
'subject' => $subj,
'from_name' => 'From Name',
'from_email' => 'from_email@example.com',
'to' => 'to_email@example.com',
'html' => $body,
'async' => false,
'ip_pool' => null,
'send_at' => '2016-02-24 19:45:00'
);
$sendmessage = wpMandrill::sendEmail($message);
调试中:
echo '<pre>'.print_r($sendmessage,true).'</pre>';
输出示例:
Array
(
[0] => Array
(
[email] => to_email@example.com
[status] => scheduled
[_id] => db835dfe43cd5d67b3743a30e184f84d
[reject_reason] =>
)
)
目前,预定的电子邮件只能通过 Mandrill 的 API 进行管理,因此您不会在 Mandrill 的仪表板中找到它们。
要列出您可以使用的预定电子邮件:
$url = 'https://mandrillapp.com/api/1.0/messages/list-scheduled.json';
$key = 'Your API key';
//$to = ''; // optional
$args = array(
'body' => array(
'key' => $key
)
);
$results = wp_remote_post( $url, $args );
$results = json_decode($results['body']);
输出示例:
Array
(
[0] => stdClass Object
(
[_id] => 1d0xe54f3b759a1153b7a53g3321f4b6
[created_at] => 2016-02-24 19:30:13
[send_at] => 2016-02-24 19:42:00
[from_email] => from_email@example.com
[to] => to_email@example.com
[subject] => Email Subject
)
[1] => stdClass Object
(
[_id] => 1272e526f6924ba096d23146e2dxad4c
[created_at] => 2016-02-24 19:31:12
[send_at] => 2016-02-24 19:45:00
[from_email] => from_email@example.com
[to] => to_email@example.com
[subject] => Email Subject
)
)
是否可以使用 wpMandrill 插件安排消息?
我看到了这个post that we can use mandrill_payload filter to change anything in the structure (following Mandrill's API , /messages/send).
如何更改 send_at 参数以便我可以安排要发送的电子邮件。
会不会是这样的:
function customFilterSendAt($send_at)
{
$send_at = "2016-01-23 14:00:00";
return $send_at;
}
add_filter('mandrill_payload', 'customFilterSendAt');
然后
wp_mail($email_adress, $subj, $body );
?
我发现可以使用 wpMandrill 安排电子邮件。 link(查看 aaroneight 评论)对我有帮助。
要使用 wpMandrill 安排您的电子邮件:
$message = array(
'subject' => $subj,
'from_name' => 'From Name',
'from_email' => 'from_email@example.com',
'to' => 'to_email@example.com',
'html' => $body,
'async' => false,
'ip_pool' => null,
'send_at' => '2016-02-24 19:45:00'
);
$sendmessage = wpMandrill::sendEmail($message);
调试中:
echo '<pre>'.print_r($sendmessage,true).'</pre>';
输出示例:
Array
(
[0] => Array
(
[email] => to_email@example.com
[status] => scheduled
[_id] => db835dfe43cd5d67b3743a30e184f84d
[reject_reason] =>
)
)
目前,预定的电子邮件只能通过 Mandrill 的 API 进行管理,因此您不会在 Mandrill 的仪表板中找到它们。
要列出您可以使用的预定电子邮件:
$url = 'https://mandrillapp.com/api/1.0/messages/list-scheduled.json';
$key = 'Your API key';
//$to = ''; // optional
$args = array(
'body' => array(
'key' => $key
)
);
$results = wp_remote_post( $url, $args );
$results = json_decode($results['body']);
输出示例:
Array
(
[0] => stdClass Object
(
[_id] => 1d0xe54f3b759a1153b7a53g3321f4b6
[created_at] => 2016-02-24 19:30:13
[send_at] => 2016-02-24 19:42:00
[from_email] => from_email@example.com
[to] => to_email@example.com
[subject] => Email Subject
)
[1] => stdClass Object
(
[_id] => 1272e526f6924ba096d23146e2dxad4c
[created_at] => 2016-02-24 19:31:12
[send_at] => 2016-02-24 19:45:00
[from_email] => from_email@example.com
[to] => to_email@example.com
[subject] => Email Subject
)
)