本文整理汇总了PHP中EM_Event::email_send方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Event::email_send方法的具体用法?PHP EM_Event::email_send怎么用?PHP EM_Event::email_send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EM_Event
的用法示例。
在下文中一共展示了EM_Event::email_send方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: em_event_submission_emails
/**
* @param boolean $result
* @param EM_Event $EM_Event
* @return boolean
*/
function em_event_submission_emails($result, $EM_Event)
{
if ($result) {
//if this is just published, we need to email the user about the publication, or send to pending mode again for review
$cant_publish_event = $EM_Event->is_individual() && !user_can($EM_Event->get_contact()->ID, 'publish_events');
$cant_publish_recurring_event = $EM_Event->is_recurring() && !user_can($EM_Event->get_contact()->ID, 'publish_recurring_events');
$output_type = get_option('dbem_smtp_html') ? 'html' : 'email';
if ($cant_publish_event || $cant_publish_recurring_event) {
if ($EM_Event->is_published() && !$EM_Event->previous_status) {
//only send email to users that can't publish events themselves and that were previously unpublished
$approvals_count = get_post_meta($EM_Event->post_id, '_event_approvals_count', true);
$approvals_count = $approvals_count > 0 ? $approvals_count : 0;
if ($approvals_count == 1) {
$subject = $EM_Event->output(get_option('dbem_event_approved_email_subject'), 'raw');
$body = $EM_Event->output(get_option('dbem_event_approved_email_body'), $output_type);
} else {
$subject = $EM_Event->output(get_option('dbem_event_reapproved_email_subject'), 'raw');
$body = $EM_Event->output(get_option('dbem_event_reapproved_email_body'), $output_type);
}
if ($EM_Event->event_owner == "") {
return true;
}
$EM_Event->email_send($subject, $body, $EM_Event->get_contact()->user_email);
} elseif (!$EM_Event->get_status() && get_option('dbem_event_submitted_email_admin') != '') {
$approvals_count = get_post_meta($EM_Event->post_id, '_event_approvals_count', true);
$approvals_count = $approvals_count > 0 ? $approvals_count : 0;
update_post_meta($EM_Event->post_id, '_event_approvals_count', $approvals_count + 1);
$admin_emails = explode(',', str_replace(' ', '', get_option('dbem_event_submitted_email_admin')));
//admin emails are in an array, single or multiple
if (empty($admin_emails)) {
return true;
}
if ($approvals_count > 1) {
$subject = $EM_Event->output(get_option('dbem_event_resubmitted_email_subject'), 'raw');
$message = $EM_Event->output(get_option('dbem_event_resubmitted_email_body'), $output_type);
} else {
$subject = $EM_Event->output(get_option('dbem_event_submitted_email_subject'), 'raw');
$message = $EM_Event->output(get_option('dbem_event_submitted_email_body'), $output_type);
}
//Send email to admins
$EM_Event->email_send($subject, $message, $admin_emails);
}
} elseif (!current_user_can('list_users')) {
if ($EM_Event->is_published() && !$EM_Event->previous_status) {
$admin_emails = explode(',', str_replace(' ', '', get_option('dbem_event_submitted_email_admin')));
//admin emails are in an array, single or multiple
if (empty($admin_emails)) {
return true;
}
$subject = $EM_Event->output(get_option('dbem_event_published_email_subject'), 'raw');
$body = $EM_Event->output(get_option('dbem_event_published_email_body'), $output_type);
$EM_Event->email_send($subject, $body, $admin_emails);
}
}
}
return $result;
}
示例2: em_event_added_email
/**
* @param EM_Event $EM_Event
* @return string
*/
function em_event_added_email($EM_Event)
{
if (!$EM_Event->get_status() && get_option('dbem_bookings_approval') && get_option('dbem_event_submitted_email_admin') != '') {
$admin_emails = explode(',', get_option('dbem_event_submitted_email_admin'));
//admin emails are in an array, single or multiple
$subject = $EM_Event->output(get_option('dbem_event_submitted_email_subject'));
$message = $EM_Event->output(get_option('dbem_event_submitted_email_body'));
//Send email to admins
$EM_Event->email_send($subject, $message, $admin_emails);
}
}
示例3: em_admin_email_test_ajax
function em_admin_email_test_ajax()
{
if (wp_verify_nonce($_REQUEST['_check_email_nonce'], 'check_email') && current_user_can('activate_plugins')) {
$subject = __("Events Manager Test Email", 'dbem');
$content = __('Congratulations! Your email settings work.', 'dbem');
$current_user = get_user_by('id', get_current_user_id());
$EM_Event = new EM_Event();
if ($EM_Event->email_send($subject, $content, $current_user->user_email)) {
$result = array('result' => true, 'message' => sprintf(__('Email sent succesfully to %s', 'dbem'), $current_user->user_email));
} else {
$result = array('result' => false, 'message' => __('Email not sent.', 'dbem') . " <ul><li>" . implode('</li><li>', $EM_Event->get_errors()) . '</li></ul>');
}
echo json_encode($result);
}
exit;
}
示例4: em_admin_email_test_ajax
function em_admin_email_test_ajax()
{
if (wp_verify_nonce($_REQUEST['_check_email_nonce'], 'check_email') && current_user_can('activate_plugins')) {
$subject = __("Events Manager Test Email", 'dbem');
$content = __('Congratulations! Your email settings work.', 'dbem');
$current_user = get_user_by('id', get_current_user_id());
//add filters for options used in EM_Mailer so the current supplied ones are used
ob_start();
function pre_option_dbem_mail_sender_name()
{
return sanitize_email($_REQUEST['dbem_mail_sender_name']);
}
add_filter('pre_option_dbem_mail_sender_name', 'pre_option_dbem_mail_sender_name');
function pre_option_dbem_mail_sender_address()
{
return sanitize_text_field($_REQUEST['dbem_mail_sender_address']);
}
add_filter('pre_option_dbem_mail_sender_address', 'pre_option_dbem_mail_sender_address');
function pre_option_dbem_rsvp_mail_send_method()
{
return sanitize_text_field($_REQUEST['dbem_rsvp_mail_send_method']);
}
add_filter('pre_option_dbem_rsvp_mail_send_method', 'pre_option_dbem_rsvp_mail_send_method');
function pre_option_dbem_rsvp_mail_port()
{
return sanitize_text_field($_REQUEST['dbem_rsvp_mail_port']);
}
add_filter('pre_option_dbem_rsvp_mail_port', 'pre_option_dbem_rsvp_mail_port');
function pre_option_dbem_rsvp_mail_SMTPAuth()
{
return sanitize_text_field($_REQUEST['dbem_rsvp_mail_SMTPAuth']);
}
add_filter('pre_option_dbem_rsvp_mail_SMTPAuth', 'pre_option_dbem_rsvp_mail_SMTPAuth');
function pre_option_dbem_smtp_host()
{
return sanitize_text_field($_REQUEST['dbem_smtp_host']);
}
add_filter('pre_option_dbem_smtp_host', 'pre_option_dbem_smtp_host');
function pre_option_dbem_smtp_username()
{
return sanitize_text_field($_REQUEST['dbem_smtp_username']);
}
add_filter('pre_option_dbem_smtp_username', 'pre_option_dbem_smtp_username');
function pre_option_dbem_smtp_password()
{
return sanitize_text_field($_REQUEST['dbem_smtp_password']);
}
add_filter('pre_option_dbem_smtp_password', 'pre_option_dbem_smtp_password');
ob_clean();
//remove any php errors/warnings output
$EM_Event = new EM_Event();
if ($EM_Event->email_send($subject, $content, $current_user->user_email)) {
$result = array('result' => true, 'message' => sprintf(__('Email sent succesfully to %s', 'dbem'), $current_user->user_email));
} else {
$result = array('result' => false, 'message' => __('Email not sent.', 'dbem') . " <ul><li>" . implode('</li><li>', $EM_Event->get_errors()) . '</li></ul>');
}
echo EM_Object::json_encode($result);
}
exit;
}