private function get_headers($format = 'plain') { if (!$this->from) { $this->from = awpcp_admin_email_from(); } switch ($format) { case 'plain': $content_type = 'text/plain; charset="' . get_option('blog_charset') . '"'; break; case 'html': $content_type = 'text/html; charset="' . get_option('blog_charset') . '"'; break; } $headers = array_merge(array('MIME-Version' => '1.0', 'Content-Type' => $content_type, 'From' => $this->from, 'Reply-To' => awpcp_admin_email_to()), $this->headers); $email_headers = ''; foreach ($headers as $k => $v) { $email_headers .= sprintf("%s: %s\r\n", $k, $v); } return $email_headers; }
/** * @since 3.4 */ function awpcp_send_listing_was_flagged_notification($listing) { if (!get_awpcp_option('send-listing-flagged-notification-to-administrators')) { return false; } $query_args = array('page' => 'awpcp-listings', 'filterby' => 'flagged', 'filter' => 1); $flagged_listings_url = add_query_arg($query_args, awpcp_get_admin_panel_url()); $params = array('site_name' => get_bloginfo('name'), 'flagged_listings_url' => $flagged_listings_url); $template = AWPCP_DIR . '/templates/email/listing-was-flagged.plain.tpl.php'; $mail = new AWPCP_Email(); $mail->to = awpcp_admin_email_to(); $mail->subject = str_replace('<listing-title>', $listing->get_title(), __('Listing <listing-title> was flagged', 'AWPCP')); $mail->prepare($template, $params); return $mail->send(); }
/** * @since 2.1.4 */ function awpcp_ad_posted_email($ad, $transaction = null, $message = '', $notify_admin = true) { $result = false; // user email $user_message = awpcp_ad_posted_user_email($ad, $transaction, $message); if (get_awpcp_option('send-user-ad-posted-notification', true)) { $result = $user_message->send(); } // admin email if ($notify_admin && get_awpcp_option('notifyofadposted')) { // grab the body to be included in the email sent to the admin $content = $user_message->body; $admin_message = new AWPCP_Email(); $admin_message->to[] = awpcp_admin_email_to(); $admin_message->subject = __('New classified listing created', 'AWPCP'); $params = array('page' => 'awpcp-listings', 'action' => 'view', 'id' => $ad->ad_id); $url = add_query_arg(urlencode_deep($params), admin_url('admin.php')); $template = AWPCP_DIR . '/frontend/templates/email-place-ad-success-admin.tpl.php'; $admin_message->prepare($template, compact('content', 'url')); $admin_message->send(); } return $result; }
/** * email the administrator and the user to notify that the payment process was failed * @since 2.1.4 */ function awpcp_payment_failed_email($transaction, $message = '') { $user = get_userdata($transaction->user_id); // user email $mail = new AWPCP_Email(); $mail->to[] = "{$user->display_name} <{$user->user_email}>"; $mail->subject = get_awpcp_option('paymentabortedsubjectline'); $template = AWPCP_DIR . '/frontend/templates/email-abort-payment-user.tpl.php'; $mail->prepare($template, compact('message', 'user', 'transaction')); $mail->send(); // admin email $mail = new AWPCP_Email(); $mail->to[] = awpcp_admin_email_to(); $mail->subject = __("Customer attempt to pay has failed", "AWPCP"); $template = AWPCP_DIR . '/frontend/templates/email-abort-payment-admin.tpl.php'; $mail->prepare($template, compact('message', 'user', 'transaction')); $mail->send(); }
function awpcp_ad_awaiting_approval_email($ad, $ad_approve, $images_approve) { // admin email $params = array('page' => 'awpcp-listings', 'action' => 'manage-images', 'id' => $ad->ad_id); $manage_images_url = add_query_arg(urlencode_deep($params), admin_url('admin.php')); if (false == $ad_approve && $images_approve) { $subject = __('Images on Ad "%s" are awaiting approval', 'AWPCP'); $message = __('Images on Ad "%s" are awaiting approval. You can approve the images going to the Manage Images section for that Ad and clicking the "Enable" button below each image. Click here to continue: %s.', 'AWPCP'); $messages = array(sprintf($message, $ad->get_title(), $manage_images_url)); } else { $subject = __('The Ad "%s" is awaiting approval', 'AWPCP'); $message = __('The Ad "%s" is awaiting approval. You can approve the Ad going to the Manage Listings section and clicking the "Enable" action shown on top. Click here to continue: %s.', 'AWPCP'); $params = array('page' => 'awpcp-listings', 'action' => 'view', 'id' => $ad->ad_id); $url = add_query_arg(urlencode_deep($params), admin_url('admin.php')); $messages[] = sprintf($message, $ad->get_title(), $url); if ($images_approve) { $message = __('Additionally, You can approve the images going to the Manage Images section for that Ad and clicking the "Enable" button below each image. Click here to continue: %s.', 'AWPCP'); $messages[] = sprintf($message, $manage_images_url); } } $mail = new AWPCP_Email(); $mail->to[] = awpcp_admin_email_to(); $mail->subject = sprintf($subject, $ad->get_title()); $template = AWPCP_DIR . '/frontend/templates/email-ad-awaiting-approval-admin.tpl.php'; $mail->prepare($template, compact('messages')); $mail->send(); }