public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new PhpMail(); } return self::$instance; }
public static function getMailer() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
header('Content-type: application/json'); echo json_encode(array('status' => 'phone_error')); exit; } elseif (empty($pm_app_form_date)) { header('Content-type: application/json'); echo json_encode(array('status' => 'date_error')); exit; } elseif (empty($pm_app_form_time)) { //print 'Please provide a short message for your inquiry.'; //exit; header('Content-type: application/json'); echo json_encode(array('status' => 'time_error')); exit; } else { //Send the report $mailer = PhpMail::getInstance(); $subject = 'Appointment Form Inquiry'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: donotreply@' . $_SERVER['SERVER_NAME'] . ' <donotreply@' . $_SERVER['SERVER_NAME'] . '>' . "\r\n"; $month = date("M", strtotime($pm_app_form_date)); $day = date("d", strtotime($pm_app_form_date)); $year = date("Y", strtotime($pm_app_form_date)); $body = ' <html> <head> <title>Appointment Form Inquiry</title> </head> <body>
/** * Sends an email using PHP's mail function, formatting it appropriately. * * @param string Address the email should be addressed to. * @param string The subject of the email being sent. * @param string The message being sent. * @param string The from address of the email, if blank, the board name will be used. * @param string The chracter set being used to send this email. * @param boolean Do we wish to keep the connection to the mail server alive to send more than one message (SMTP only) * @param string The format of the email to be sent (text or html). text is default * @param string The text message of the email if being sent in html format, for email clients that don't support html * @param string The email address to return to. Defaults to admin return email address. */ function my_mail($to, $subject, $message, $from = "", $charset = "", $headers = "", $keep_alive = false, $format = "text", $message_text = "", $return_email = "") { global $mybb; static $mail; // Does our object not exist? Create it if (!is_object($mail)) { require_once MYBB_ROOT . "inc/class_mailhandler.php"; if ($mybb->settings['mail_handler'] == 'smtp') { require_once MYBB_ROOT . "inc/mailhandlers/smtp.php"; $mail = new SmtpMail(); } else { require_once MYBB_ROOT . "inc/mailhandlers/php.php"; $mail = new PhpMail(); } } // Using SMTP based mail if ($mybb->settings['mail_handler'] == 'smtp') { if ($keep_alive == true) { $mail->keep_alive = true; } } else { if ($mybb->settings['mail_parameters'] != '') { $mail->additional_parameters = $mybb->settings['mail_parameters']; } } // Build and send $mail->build_message($to, $subject, $message, $from, $charset, $headers, $format, $message_text, $return_email); return $mail->send(); }