// Set mail's subject and body $phpmailer->Subject = $subject; $phpmailer->Body = $message; // Add any CC and BCC recipients if (!empty($cc)) { foreach ((array) $cc as $recipient) { try { // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>" $recipient_name = ''; if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) { if (count($matches) == 3) { $recipient_name = $matches[1]; $recipient = $matches[2]; } } $phpmailer->AddCc($recipient, $recipient_name); } catch (phpmailerException $e) { continue; } } } if (!empty($bcc)) { foreach ((array) $bcc as $recipient) { try { // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>" $recipient_name = ''; if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) { if (count($matches) == 3) { $recipient_name = $matches[1]; $recipient = $matches[2]; }
/** * Send mail, similar to PHP's mail * * A true return value does not automatically mean that the user received the * email successfully. It just only means that the method used was able to * process the request without any errors. * * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from * creating a from address like 'Name <*****@*****.**>' when both are set. If * just 'wp_mail_from' is set, then just the email address will be used with no * name. * * The default content type is 'text/plain' which does not allow using HTML. * However, you can set the content type of the email by using the * 'wp_mail_content_type' filter. * * The default charset is based on the charset used on the blog. The charset can * be set using the 'wp_mail_charset' filter. * * @since 1.2.1 * * @uses PHPMailer * * @param string|array $to Array or comma-separated list of email addresses to send message. * @param string $subject Email subject * @param string $message Message contents * @param string|array $headers Optional. Additional headers. * @param string|array $attachments Optional. Files to attach. * @return bool Whether the email contents were sent successfully. */ function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) { // Compact the input, apply the filters, and extract them back out /** * Filter the wp_mail() arguments. * * @since 2.2.0 * * @param array $args A compacted array of wp_mail() arguments, including the "to" email, * subject, message, headers, and attachments values. */ $atts = apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers', 'attachments')); if (isset($atts['to'])) { $to = $atts['to']; } if (isset($atts['subject'])) { $subject = $atts['subject']; } if (isset($atts['message'])) { $message = $atts['message']; } if (isset($atts['headers'])) { $headers = $atts['headers']; } if (isset($atts['attachments'])) { $attachments = $atts['attachments']; } if (!is_array($attachments)) { $attachments = explode("\n", str_replace("\r\n", "\n", $attachments)); } global $phpmailer; // (Re)create it, if it's gone missing if (!$phpmailer instanceof PHPMailer) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer(true); } // Headers if (empty($headers)) { $headers = array(); } else { if (!is_array($headers)) { // Explode the headers out, so this function can take both // string headers and an array of headers. $tempheaders = explode("\n", str_replace("\r\n", "\n", $headers)); } else { $tempheaders = $headers; } $headers = array(); $cc = array(); $bcc = array(); // If it's actually got contents if (!empty($tempheaders)) { // Iterate through the raw headers foreach ((array) $tempheaders as $header) { if (strpos($header, ':') === false) { if (false !== stripos($header, 'boundary=')) { $parts = preg_split('/boundary=/i', trim($header)); $boundary = trim(str_replace(array("'", '"'), '', $parts[1])); } continue; } // Explode them out list($name, $content) = explode(':', trim($header), 2); // Cleanup crew $name = trim($name); $content = trim($content); switch (strtolower($name)) { // Mainly for legacy -- process a From: header if it's there case 'from': $bracket_pos = strpos($content, '<'); if ($bracket_pos !== false) { // Text before the bracketed email is the "From" name. if ($bracket_pos > 0) { $from_name = substr($content, 0, $bracket_pos - 1); $from_name = str_replace('"', '', $from_name); $from_name = trim($from_name); } $from_email = substr($content, $bracket_pos + 1); $from_email = str_replace('>', '', $from_email); $from_email = trim($from_email); // Avoid setting an empty $from_email. } elseif ('' !== trim($content)) { $from_email = trim($content); } break; case 'content-type': if (strpos($content, ';') !== false) { list($type, $charset_content) = explode(';', $content); $content_type = trim($type); if (false !== stripos($charset_content, 'charset=')) { $charset = trim(str_replace(array('charset=', '"'), '', $charset_content)); } elseif (false !== stripos($charset_content, 'boundary=')) { $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset_content)); $charset = ''; } // Avoid setting an empty $content_type. } elseif ('' !== trim($content)) { $content_type = trim($content); } break; case 'cc': $cc = array_merge((array) $cc, explode(',', $content)); break; case 'bcc': $bcc = array_merge((array) $bcc, explode(',', $content)); break; default: // Add it to our grand headers array $headers[trim($name)] = trim($content); break; } } } } // Empty out the values that may be set $phpmailer->ClearAllRecipients(); $phpmailer->ClearAttachments(); $phpmailer->ClearCustomHeaders(); $phpmailer->ClearReplyTos(); // From email and name // If we don't have a name from the input headers if (!isset($from_name)) { $from_name = 'WordPress'; } /* If we don't have an email from the input headers default to wordpress@$sitename * Some hosts will block outgoing mail from this address if it doesn't exist but * there's no easy alternative. Defaulting to admin_email might appear to be another * option but some hosts may refuse to relay mail from an unknown domain. See * https://core.trac.wordpress.org/ticket/5007. */ if (!isset($from_email)) { // Get the site domain and get rid of www. $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } $from_email = 'wordpress@' . $sitename; } /** * Filter the email address to send from. * * @since 2.2.0 * * @param string $from_email Email address to send from. */ $phpmailer->From = apply_filters('wp_mail_from', $from_email); /** * Filter the name to associate with the "from" email address. * * @since 2.3.0 * * @param string $from_name Name associated with the "from" email address. */ $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name); // Set destination addresses if (!is_array($to)) { $to = explode(',', $to); } foreach ((array) $to as $recipient) { try { // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>" $recipient_name = ''; if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) { if (count($matches) == 3) { $recipient_name = $matches[1]; $recipient = $matches[2]; } } $phpmailer->AddAddress($recipient, $recipient_name); } catch (phpmailerException $e) { continue; } } // Set mail's subject and body $phpmailer->Subject = $subject; $phpmailer->Body = $message; // Add any CC and BCC recipients if (!empty($cc)) { foreach ((array) $cc as $recipient) { try { // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>" $recipient_name = ''; if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) { if (count($matches) == 3) { $recipient_name = $matches[1]; $recipient = $matches[2]; } } $phpmailer->AddCc($recipient, $recipient_name); } catch (phpmailerException $e) { continue; } } } if (!empty($bcc)) { foreach ((array) $bcc as $recipient) { try { // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>" $recipient_name = ''; if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) { if (count($matches) == 3) { $recipient_name = $matches[1]; $recipient = $matches[2]; } } $phpmailer->AddBcc($recipient, $recipient_name); } catch (phpmailerException $e) { continue; } } } // Set to use PHP's mail() $phpmailer->IsMail(); // Set Content-Type and charset // If we don't have a content-type from the input headers if (!isset($content_type)) { $content_type = 'text/plain'; } /** * Filter the wp_mail() content type. * * @since 2.3.0 * * @param string $content_type Default wp_mail() content type. */ $content_type = apply_filters('wp_mail_content_type', $content_type); $phpmailer->ContentType = $content_type; // Set whether it's plaintext, depending on $content_type if ('text/html' == $content_type) { $phpmailer->IsHTML(true); } // If we don't have a charset from the input headers if (!isset($charset)) { $charset = get_bloginfo('charset'); } // Set the content-type and charset /** * Filter the default wp_mail() charset. * * @since 2.3.0 * * @param string $charset Default email charset. */ $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset); // Set custom headers if (!empty($headers)) { foreach ((array) $headers as $name => $content) { $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content)); } if (false !== stripos($content_type, 'multipart') && !empty($boundary)) { $phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary)); } } if (!empty($attachments)) { foreach ($attachments as $attachment) { try { $phpmailer->AddAttachment($attachment); } catch (phpmailerException $e) { continue; } } } /** * Fires after PHPMailer is initialized. * * @since 2.2.0 * * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference. */ do_action_ref_array('phpmailer_init', array(&$phpmailer)); // Send! try { return $phpmailer->Send(); } catch (phpmailerException $e) { return false; } }
/** * Send mail, similar to PHP's mail * * A true return value does not automatically mean that the user received the * email successfully. It just only means that the method used was able to * process the request without any errors. * * Using the two 'bb_mail_from' and 'bb_mail_from_name' hooks allow from * creating a from address like 'Name <*****@*****.**>' when both are set. If * just 'bb_mail_from' is set, then just the email address will be used with no * name. * * The default content type is 'text/plain' which does not allow using HTML. * However, you can set the content type of the email by using the * 'bb_mail_content_type' filter. * * The default charset is based on the charset used on the blog. The charset can * be set using the 'bb_mail_charset' filter. * * @uses apply_filters() Calls 'bb_mail' hook on an array of all of the parameters. * @uses apply_filters() Calls 'bb_mail_from' hook to get the from email address. * @uses apply_filters() Calls 'bb_mail_from_name' hook to get the from address name. * @uses apply_filters() Calls 'bb_mail_content_type' hook to get the email content type. * @uses apply_filters() Calls 'bb_mail_charset' hook to get the email charset * @uses do_action_ref_array() Calls 'bb_phpmailer_init' hook on the reference to * phpmailer object. * @uses PHPMailer * * @param string $to Email address to send message * @param string $subject Email subject * @param string $message Message contents * @param string|array $headers Optional. Additional headers. * @param string|array $attachments Optional. Files to attach. * @return bool Whether the email contents were sent successfully. */ function bb_mail($to, $subject, $message, $headers = '', $attachments = array()) { // Compact the input, apply the filters, and extract them back out extract(apply_filters('bb_mail', compact('to', 'subject', 'message', 'headers', 'attachments'))); if (!is_array($attachments)) { $attachments = explode("\n", $attachments); } global $bb_phpmailer; // (Re)create it, if it's gone missing if (!is_object($bb_phpmailer) || !is_a($bb_phpmailer, 'PHPMailer')) { require_once BACKPRESS_PATH . 'class.mailer.php'; require_once BACKPRESS_PATH . 'class.mailer-smtp.php'; $bb_phpmailer = new PHPMailer(); } // Headers if (empty($headers)) { $headers = array(); } else { if (!is_array($headers)) { // Explode the headers out, so this function can take both // string headers and an array of headers. $tempheaders = (array) explode("\n", $headers); } else { $tempheaders = $headers; } $headers = array(); // If it's actually got contents if (!empty($tempheaders)) { // Iterate through the raw headers foreach ((array) $tempheaders as $header) { if (strpos($header, ':') === false) { if (false !== stripos($header, 'boundary=')) { $parts = preg_split('/boundary=/i', trim($header)); $boundary = trim(str_replace(array("'", '"'), '', $parts[1])); } continue; } // Explode them out list($name, $content) = explode(':', trim($header), 2); // Cleanup crew $name = trim($name); $content = trim($content); // Mainly for legacy -- process a From: header if it's there if ('from' == strtolower($name)) { if (strpos($content, '<') !== false) { // So... making my life hard again? $from_name = substr($content, 0, strpos($content, '<') - 1); $from_name = str_replace('"', '', $from_name); $from_name = trim($from_name); $from_email = substr($content, strpos($content, '<') + 1); $from_email = str_replace('>', '', $from_email); $from_email = trim($from_email); } else { $from_email = trim($content); } } elseif ('content-type' == strtolower($name)) { if (strpos($content, ';') !== false) { list($type, $charset) = explode(';', $content); $content_type = trim($type); if (false !== stripos($charset, 'charset=')) { $charset = trim(str_replace(array('charset=', '"'), '', $charset)); } elseif (false !== stripos($charset, 'boundary=')) { $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset)); $charset = ''; } } else { $content_type = trim($content); } } elseif ('cc' == strtolower($name)) { $cc = explode(",", $content); } elseif ('bcc' == strtolower($name)) { $bcc = explode(",", $content); } else { // Add it to our grand headers array $headers[trim($name)] = trim($content); } } } } // Empty out the values that may be set $bb_phpmailer->ClearAddresses(); $bb_phpmailer->ClearAllRecipients(); $bb_phpmailer->ClearAttachments(); $bb_phpmailer->ClearBCCs(); $bb_phpmailer->ClearCCs(); $bb_phpmailer->ClearCustomHeaders(); $bb_phpmailer->ClearReplyTos(); // From email and name // If we don't have a name from the input headers if (!isset($from_name)) { $from_name = bb_get_option('name'); } // If we don't have an email from the input headers if (!isset($from_email)) { $from_email = bb_get_option('from_email'); } // If there is still no email address if (!$from_email) { // Get the site domain and get rid of www. $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } $from_email = 'bbpress@' . $sitename; } // Plugin authors can override the potentially troublesome default $bb_phpmailer->From = apply_filters('bb_mail_from', $from_email); $bb_phpmailer->FromName = apply_filters('bb_mail_from_name', $from_name); // Set destination address $bb_phpmailer->AddAddress($to); // Set mail's subject and body $bb_phpmailer->Subject = $subject; $bb_phpmailer->Body = $message; // Add any CC and BCC recipients if (!empty($cc)) { foreach ((array) $cc as $recipient) { $bb_phpmailer->AddCc(trim($recipient)); } } if (!empty($bcc)) { foreach ((array) $bcc as $recipient) { $bb_phpmailer->AddBcc(trim($recipient)); } } // Set to use PHP's mail() $bb_phpmailer->IsMail(); // Set Content-Type and charset // If we don't have a content-type from the input headers if (!isset($content_type)) { $content_type = 'text/plain'; } $content_type = apply_filters('bb_mail_content_type', $content_type); $bb_phpmailer->ContentType = $content_type; // Set whether it's plaintext or not, depending on $content_type if ($content_type == 'text/html') { $bb_phpmailer->IsHTML(true); } // If we don't have a charset from the input headers if (!isset($charset)) { $charset = bb_get_option('charset'); } // Set the content-type and charset $bb_phpmailer->CharSet = apply_filters('bb_mail_charset', $charset); // Set custom headers if (!empty($headers)) { foreach ((array) $headers as $name => $content) { $bb_phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content)); } if (false !== stripos($content_type, 'multipart') && !empty($boundary)) { $bb_phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary)); } } if (!empty($attachments)) { foreach ($attachments as $attachment) { $bb_phpmailer->AddAttachment($attachment); } } do_action_ref_array('bb_phpmailer_init', array(&$bb_phpmailer)); // Send! $result = @$bb_phpmailer->Send(); return $result; }
/** * Send mail, similar to PHP's mail * * A true return value does not automatically mean that the user received the * email successfully. It just only means that the method used was able to * process the request without any errors. * * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from * creating a from address like 'Name <*****@*****.**>' when both are set. If * just 'wp_mail_from' is set, then just the email address will be used with no * name. * * The default content type is 'text/plain' which does not allow using HTML. * However, you can set the content type of the email by using the * 'wp_mail_content_type' filter. * * The default charset is based on the charset used on the blog. The charset can * be set using the 'wp_mail_charset' filter. * * @since 1.2.1 * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters. * @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address. * @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name. * @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type. * @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset * @uses do_action_ref_array() Calls 'phpmailer_init' hook on the reference to * phpmailer object. * @uses PHPMailer * @ * * @param string $to Email address to send message * @param string $subject Email subject * @param string $message Message contents * @param string|array $headers Optional. Additional headers. * @return bool Whether the email contents were sent successfully. */ function wp_mail($to, $subject, $message, $headers = '') { // Compact the input, apply the filters, and extract them back out extract(apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers'))); global $phpmailer; // (Re)create it, if it's gone missing if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer(); } // Headers if (empty($headers)) { $headers = array(); } elseif (!is_array($headers)) { // Explode the headers out, so this function can take both // string headers and an array of headers. $tempheaders = (array) explode("\n", $headers); $headers = array(); // If it's actually got contents if (!empty($tempheaders)) { // Iterate through the raw headers foreach ($tempheaders as $header) { if (strpos($header, ':') === false) { continue; } // Explode them out list($name, $content) = explode(':', trim($header), 2); // Cleanup crew $name = trim($name); $content = trim($content); // Mainly for legacy -- process a From: header if it's there if ('from' == strtolower($name)) { if (strpos($content, '<') !== false) { // So... making my life hard again? $from_name = substr($content, 0, strpos($content, '<') - 1); $from_name = str_replace('"', '', $from_name); $from_name = trim($from_name); $from_email = substr($content, strpos($content, '<') + 1); $from_email = str_replace('>', '', $from_email); $from_email = trim($from_email); } else { $from_name = trim($content); } } elseif ('content-type' == strtolower($name)) { if (strpos($content, ';') !== false) { list($type, $charset) = explode(';', $content); $content_type = trim($type); $charset = trim(str_replace(array('charset=', '"'), '', $charset)); } else { $content_type = trim($content); } } elseif ('cc' == strtolower($name)) { $cc = explode(",", $content); } elseif ('bcc' == strtolower($name)) { $bcc = explode(",", $content); } else { // Add it to our grand headers array $headers[trim($name)] = trim($content); } } } } // Empty out the values that may be set $phpmailer->ClearAddresses(); $phpmailer->ClearAllRecipients(); $phpmailer->ClearAttachments(); $phpmailer->ClearBCCs(); $phpmailer->ClearCCs(); $phpmailer->ClearCustomHeaders(); $phpmailer->ClearReplyTos(); // From email and name // If we don't have a name from the input headers if (!isset($from_name)) { $from_name = 'WordPress'; } // If we don't have an email from the input headers if (!isset($from_email)) { // Get the site domain and get rid of www. $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } $from_email = 'wordpress@' . $sitename; } // Set the from name and email $phpmailer->From = apply_filters('wp_mail_from', $from_email); $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name); // Set destination address $phpmailer->AddAddress($to); // Set mail's subject and body $phpmailer->Subject = $subject; $phpmailer->Body = $message; // Add any CC and BCC recipients if (!empty($cc)) { foreach ($cc as $recipient) { $phpmailer->AddCc(trim($recipient)); } } if (!empty($bcc)) { foreach ($bcc as $recipient) { $phpmailer->AddBcc(trim($recipient)); } } // Set to use PHP's mail() $phpmailer->IsMail(); // Set Content-Type and charset // If we don't have a content-type from the input headers if (!isset($content_type)) { $content_type = 'text/plain'; } $content_type = apply_filters('wp_mail_content_type', $content_type); // Set whether it's plaintext or not, depending on $content_type if ($content_type == 'text/html') { $phpmailer->IsHTML(true); } else { $phpmailer->IsHTML(false); } // If we don't have a charset from the input headers if (!isset($charset)) { $charset = get_bloginfo('charset'); } // Set the content-type and charset $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset); // Set custom headers if (!empty($headers)) { foreach ($headers as $name => $content) { $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content)); } } do_action_ref_array('phpmailer_init', array(&$phpmailer)); // Send! $result = @$phpmailer->Send(); return $result; }
/** * Function to mail the content * @param string $content * @param string $subject * @param string $email (from email) * @param string $realname (from name) * @param string/array $recipient (to) * @return void */ function mail_it($content, $subject, $email, $realname, $recipient, $inbound = true) { global $attachment_chunk, $attachment_name, $attachment_type, $attachment_temp; global $local_chunk, $local_name, $local_type, $local_temp; global $bcc, $cc; global $PHPMailerLocation, $PHPMailerLiteLocation; global $fixedFromEmail, $fixedFromName, $text_only, $htmlCharset; global $addToCSV; $valSent = false; if ($realname) { $sendTo = $realname . "<" . $email . ">"; } else { $sendTo = $email; } $ob = "----=_OuterBoundary_000"; $ib = "----=_InnerBoundery_001"; $mail_headers = "MIME-Version: 1.0\r\n"; if ($fixedFromEmail != '') { $mail_headers .= "From: " . $fixedFromEmail . "\n"; } else { $mail_headers .= "From: " . $sendTo . "\n"; } $mail_headers .= "To: " . $recipient . "\n"; $mail_headers .= "Reply-To: " . $sendTo . "\n"; if ($cc) { $mail_headers .= "Cc: " . $cc . "\n"; } if ($bcc) { $mail_headers .= "Bcc: " . $bcc . "\n"; } $mail_headers .= "X-Priority: 1\n"; $mail_headers .= "X-Mailer: PHPMailer-FE v" . VERSION . " (software by worxware.com)\n"; $mail_headers .= "Content-Type: multipart/mixed;\n\tboundary=\"" . $ob . "\"\n"; $mail_message = "This is a multi-part message in MIME format.\n"; $mail_message .= "\n--" . $ob . "\n"; $mail_message .= "Content-Type: multipart/alternative;\n\tboundary=\"" . $ib . "\"\n\n"; $mail_message .= "\n--" . $ib . "\n"; $mail_message .= "Content-Type: text/plain;\n\tcharset=\"" . $htmlCharset . "\"\n"; $mail_message .= "Content-Transfer-Encoding: quoted-printable\n\n"; $mail_message .= $content["text"] . "\n\n"; $mail_message .= "\n--" . $ib . "--\n"; if ($attachment_name && $inbound) { reset($attachment_name); reset($attachment_temp); //loop through the arrays to get the attached file names and attach each one. while ((list($key1, $val1) = each($attachment_name)) && (list($key2, $val2) = each($attachment_temp)) && (list($key3, $val3) = each($attachment_type)) && (list($key4, $val4) = each($attachment_chunk))) { $mail_message .= "\n--" . $ob . "\n"; $mail_message .= "Content-Type: {$val3};\n\tname=\"" . $val1 . "\"\n"; $mail_message .= "Content-Transfer-Encoding: base64\n"; $mail_message .= "Content-Disposition: attachment;\n\tfilename=\"" . $val1 . "\"\n\n"; $mail_message .= $val4; $mail_message .= "\n\n"; } } else { if ($local_name && $inbound === false) { $mail_message .= "\n--" . $ob . "\n"; $mail_message .= "Content-Type: {$local_type};\n\tname=\"" . $local_name . "\"\n"; $mail_message .= "Content-Transfer-Encoding: base64\n"; $mail_message .= "Content-Disposition: attachment;\n\tfilename=\"" . $local_name . "\"\n\n"; $mail_message .= $local_chunk; $mail_message .= "\n\n"; } } $mail_message .= "\n--" . $ob . "--\n"; if ((class_exists('PHPMailerLite') || class_exists('PHPMailer') || file_exists($PHPMailerLocation) || file_exists($PHPMailerLiteLocation)) && $_POST['text_only'] !== true) { if (!class_exists('PHPMailerLite') && file_exists($PHPMailerLiteLocation)) { require_once $PHPMailerLiteLocation; $mail = new PHPMailerLite(); } elseif (!class_exists('PHPMailer') && file_exists($PHPMailerLocation)) { require_once $PHPMailerLocation; $mail = new PHPMailer(); } if (isset($_POST['Mailer']) && strtolower(trim($_POST['Mailer'])) == "smtp") { $mail->IsSMTP(); if (isset($_POST['Host']) && trim($_POST['Host']) != "") { $mail->Host = trim($_POST['Host']); } if (isset($_POST['Port']) && trim($_POST['Port']) != "") { $mail->Port = trim($_POST['Port']); } if (isset($_POST['SMTPAuth']) && ($_POST['SMTPAuth'] === true || $_POST['SMTPAuth'] === false)) { $mail->SMTPAuth = $_POST['SMTPAuth']; } if (isset($_POST['Username']) && trim($_POST['Username']) != "") { $mail->Username = trim($_POST['Username']); } if (isset($_POST['Username']) && trim($_POST['Username']) != "") { $mail->Password = trim($_POST['Password']); } if (isset($_POST['Timeout']) && trim($_POST['Timeout']) != "") { $mail->Timeout = trim($_POST['Timeout']); } } elseif (isset($_POST['Mailer']) && strtolower(trim($_POST['Mailer'])) == "sendmail") { $mail->IsSendmail(); } elseif (isset($_POST['Mailer']) && strtolower(trim($_POST['Mailer'])) == "qmail") { $mail->IsQmail(); } if (isset($_POST['fixedFromEmail'])) { if (isset($_POST['fixedFromName']) && trim($_POST['fixedFromName']) == '') { $_POST['fixedFromName'] = $_POST['fixedFromEmail']; } if (stristr($mail->Version, '5.1')) { $mail->SetFrom($_POST['fixedFromEmail'], $_POST['fixedFromName']); } elseif (stristr($mail->Version, '5')) { $mail->SetFrom($_POST['fixedFromEmail'], $_POST['fixedFromName']); $mail->AddReplyTo($_POST['fixedFromEmail'], $_POST['fixedFromName']); } else { $mail->SetFrom($_POST['fixedFromEmail'], $_POST['fixedFromName']); } } else { if (!isset($realname) && trim($realname) == '') { $realname = $email; } if (stristr($mail->Version, '5.1')) { $mail->SetFrom($email, $realname); } elseif ($mail->Version >= 5) { $mail->SetFrom($email, $realname); $mail->AddReplyTo($email, $realname); } else { $mail->From = $email; $mail->FromName = $realname; } } $mail->Subject = $subject; $mail->AddAddress($recipient); if ($bcc) { if (strpos($bcc, ",") || strpos($bcc, ";")) { $bcc_in = explode(',', $bcc); foreach ($bcc_in as $key => $value) { $mail->AddBcc($value); } } else { $mail->AddBcc($bcc); } } if ($cc) { if (strpos($cc, ",") || strpos($cc, ";")) { $cc_in = explode(',', $cc); foreach ($cc_in as $key => $value) { $mail->AddCc($value); } } else { $mail->AddCc($cc); } } $mail->MsgHTML($content["html"]); $mail->AltBody = _html2txt($content['html']); if ($attachment_name && $inbound) { //Add attachment function is in phpmailer //reset the arrays to the top reset($attachment_name); reset($attachment_temp); //loop through the arrays to get the attached file names and attach each one. while ((list($key1, $val1) = each($attachment_name)) && (list($key2, $val2) = each($attachment_temp))) { $atchmnt = file_get_contents($val2); $mail->AddStringAttachment($atchmnt, $val1); } } else { if ($local_name && $inbound === false) { $mail->AddAttachment($local_temp, $local_name); } } if ($mail->Send()) { echo '<script type="text/javascript">document.getElementById("feprocessing").src="_src/complete.gif";</script>'; $valSent = true; } } else { if (@mail($recipient, $subject, $mail_message, $mail_headers)) { echo '<script type="text/javascript">document.getElementById("feprocessing").src="_src/complete.gif";</script>'; $valSent = true; } } if ($addToCSV) { $writeVal = _writeLine($subject, $content['csv']); } if ($valSent) { return true; } }
/** * Send mail, similar to PHP's mail * * A true return value does not automatically mean that the user received the * email successfully. It just only means that the method used was able to * process the request without any errors. * * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from * creating a from address like 'Name <*****@*****.**>' when both are set. If * just 'wp_mail_from' is set, then just the email address will be used with no * name. * * The default content type is 'text/plain' which does not allow using HTML. * However, you can set the content type of the email by using the * 'wp_mail_content_type' filter. * * The default charset is based on the charset used on the blog. The charset can * be set using the 'wp_mail_charset' filter. * * @since 1.2.1 * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters. * @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address. * @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name. * @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type. * @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset * @uses do_action_ref_array() Calls 'phpmailer_init' hook on the reference to * phpmailer object. * @uses PHPMailer * @ * * @param string|array $to Array or comma-separated list of email addresses to send message. * @param string $subject Email subject * @param string $message Message contents * @param string|array $headers Optional. Additional headers. * @param string|array $attachments Optional. Files to attach. * @return bool Whether the email contents were sent successfully. */ function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) { // Compact the input, apply the filters, and extract them back out extract(apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers', 'attachments'))); if (!is_array($attachments)) { $attachments = explode("\n", str_replace("\r\n", "\n", $attachments)); } global $phpmailer; // (Re)create it, if it's gone missing if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) { require_once BACKPRESS_PATH . '/class.mailer.php'; require_once BACKPRESS_PATH . '/class.mailer-smtp.php'; $phpmailer = new PHPMailer(); } // Headers if (empty($headers)) { $headers = array(); } else { if (!is_array($headers)) { // Explode the headers out, so this function can take both // string headers and an array of headers. $tempheaders = explode("\n", str_replace("\r\n", "\n", $headers)); } else { $tempheaders = $headers; } $headers = array(); // If it's actually got contents if (!empty($tempheaders)) { // Iterate through the raw headers foreach ((array) $tempheaders as $header) { if (strpos($header, ':') === false) { if (false !== stripos($header, 'boundary=')) { $parts = preg_split('/boundary=/i', trim($header)); $boundary = trim(str_replace(array("'", '"'), '', $parts[1])); } continue; } // Explode them out list($name, $content) = explode(':', trim($header), 2); // Cleanup crew $name = trim($name); $content = trim($content); switch (strtolower($name)) { // Mainly for legacy -- process a From: header if it's there case 'from': if (strpos($content, '<') !== false) { // So... making my life hard again? $from_name = substr($content, 0, strpos($content, '<') - 1); $from_name = str_replace('"', '', $from_name); $from_name = trim($from_name); $from_email = substr($content, strpos($content, '<') + 1); $from_email = str_replace('>', '', $from_email); $from_email = trim($from_email); } else { $from_email = trim($content); } break; case 'content-type': if (strpos($content, ';') !== false) { list($type, $charset) = explode(';', $content); $content_type = trim($type); if (false !== stripos($charset, 'charset=')) { $charset = trim(str_replace(array('charset=', '"'), '', $charset)); } elseif (false !== stripos($charset, 'boundary=')) { $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset)); $charset = ''; } } else { $content_type = trim($content); } break; case 'cc': $cc = array_merge((array) $cc, explode(',', $content)); break; case 'bcc': $bcc = array_merge((array) $bcc, explode(',', $content)); break; case 'message-id': $message_id = trim($content); default: // Add it to our grand headers array $headers[trim($name)] = trim($content); break; } } } } // Empty out the values that may be set $phpmailer->ClearAddresses(); $phpmailer->ClearAllRecipients(); $phpmailer->ClearAttachments(); $phpmailer->ClearBCCs(); $phpmailer->ClearCCs(); $phpmailer->ClearCustomHeaders(); $phpmailer->ClearReplyTos(); // From email and name // If we don't have a name from the input headers if (!isset($from_name)) { $from_name = 'WordPress'; } /* If we don't have an email from the input headers default to wordpress@$sitename * Some hosts will block outgoing mail from this address if it doesn't exist but * there's no easy alternative. Defaulting to admin_email might appear to be another * option but some hosts may refuse to relay mail from an unknown domain. See * http://trac.wordpress.org/ticket/5007. */ if (!isset($from_email)) { // Get the site domain and get rid of www. $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } $from_email = 'wordpress@' . $sitename; } // Plugin authors can override the potentially troublesome default $phpmailer->From = apply_filters('wp_mail_from', $from_email); $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name); // Set destination addresses if (!is_array($to)) { $to = explode(',', $to); } foreach ((array) $to as $recipient) { $phpmailer->AddAddress(trim($recipient)); } // Set mail's subject and body $phpmailer->Subject = $subject; $phpmailer->Body = $message; // Add any CC and BCC recipients if (!empty($cc)) { foreach ((array) $cc as $recipient) { $phpmailer->AddCc(trim($recipient)); } } if (!empty($bcc)) { foreach ((array) $bcc as $recipient) { $phpmailer->AddBcc(trim($recipient)); } } if (!empty($message_id)) { $phpmailer->MessageID = $message_id; } // Set to use PHP's mail() $phpmailer->IsMail(); // SupportPress: use STMP if configured if (defined('SMTP_HOST') && SMTP_HOST) { $phpmailer->IsSMTP(); $phpmailer->Host = SMTP_HOST; if (SMTP_PORT) { $phpmailer->Host .= ':' . SMTP_PORT; } global $email_domain; $phpmailer->Hostname = $email_domain; if (SMTP_USER) { $phpmailer->SMTPAuth = true; $phpmailer->Username = SMTP_USER; $phpmailer->Password = SMTP_PASSWORD; } } // Set Content-Type and charset // If we don't have a content-type from the input headers if (!isset($content_type)) { $content_type = 'text/plain'; } $content_type = apply_filters('wp_mail_content_type', $content_type); $phpmailer->ContentType = $content_type; // Set whether it's plaintext, depending on $content_type if ('text/html' == $content_type) { $phpmailer->IsHTML(true); } // If we don't have a charset from the input headers if (!isset($charset)) { $charset = 'utf-8'; } // Set the content-type and charset $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset); // Set custom headers if (!empty($headers)) { foreach ((array) $headers as $name => $content) { $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content)); } if (false !== stripos($content_type, 'multipart') && !empty($boundary)) { $phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary)); } } if (!empty($attachments)) { foreach ($attachments as $attachment) { $phpmailer->AddAttachment($attachment); } } do_action_ref_array('phpmailer_init', array(&$phpmailer)); // Send! $result = @$phpmailer->Send(); return $result; }
/** * Send mail, similar to PHP's mail * * A true return value does not automatically mean that the user received the * email successfully. It just only means that the method used was able to * process the request without any errors. * * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from * creating a from address like 'Name <*****@*****.**>' when both are set. If * just 'wp_mail_from' is set, then just the email address will be used with no * name. * * The default content type is 'text/plain' which does not allow using HTML. * However, you can set the content type of the email by using the * 'wp_mail_content_type' filter. * * If $message is an array, the key of each is used to add as an attachment * with the value used as the body. The 'text/plain' element is used as the * text version of the body, with the 'text/html' element used as the HTML * version of the body. All other types are added as attachments. * * The default charset is based on the charset used on the blog. The charset can * be set using the 'wp_mail_charset' filter. * * @since 1.2.1 * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters. * @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address. * @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name. * @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type. * @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset * @uses do_action_ref_array() Calls 'phpmailer_init' hook on the reference to * phpmailer object. * @uses PHPMailer * @ * * @param string|array $to Array or comma-separated list of email addresses to send message. * @param string $subject Email subject * @param string|array $message Message contents * @param string|array $headers Optional. Additional headers. * @param string|array $attachments Optional. Files to attach. * @return bool Whether the email contents were sent successfully. */ function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) { // Compact the input, apply the filters, and extract them back out extract(apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers', 'attachments'))); if (!is_array($attachments)) { $attachments = explode("\n", str_replace("\r\n", "\n", $attachments)); } global $phpmailer; // (Re)create it, if it's gone missing if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer(true); } // Headers if (empty($headers)) { $headers = array(); } else { if (!is_array($headers)) { // Explode the headers out, so this function can take both // string headers and an array of headers. $tempheaders = explode("\n", str_replace("\r\n", "\n", $headers)); } else { $tempheaders = $headers; } $headers = array(); $cc = array(); $bcc = array(); // If it's actually got contents if (!empty($tempheaders)) { // Iterate through the raw headers foreach ((array) $tempheaders as $header) { if (strpos($header, ':') === false) { if (false !== stripos($header, 'boundary=')) { $parts = preg_split('/boundary=/i', trim($header)); $boundary = trim(str_replace(array("'", '"'), '', $parts[1])); } continue; } // Explode them out list($name, $content) = explode(':', trim($header), 2); // Cleanup crew $name = trim($name); $content = trim($content); switch (strtolower($name)) { // Mainly for legacy -- process a From: header if it's there case 'from': if (strpos($content, '<') !== false) { // So... making my life hard again? $from_name = substr($content, 0, strpos($content, '<') - 1); $from_name = str_replace('"', '', $from_name); $from_name = trim($from_name); $from_email = substr($content, strpos($content, '<') + 1); $from_email = str_replace('>', '', $from_email); $from_email = trim($from_email); } else { $from_email = trim($content); } break; case 'content-type': if (is_array($message)) { // Multipart email, ignore the content-type header break; } if (strpos($content, ';') !== false) { list($type, $charset) = explode(';', $content); $content_type = trim($type); if (false !== stripos($charset, 'charset=')) { $charset = trim(str_replace(array('charset=', '"'), '', $charset)); } elseif (false !== stripos($charset, 'boundary=')) { $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset)); $charset = ''; } } else { $content_type = trim($content); } break; case 'cc': $cc = array_merge((array) $cc, explode(',', $content)); break; case 'bcc': $bcc = array_merge((array) $bcc, explode(',', $content)); break; default: // Add it to our grand headers array $headers[trim($name)] = trim($content); break; } } } } // Empty out the values that may be set $phpmailer->ClearAddresses(); $phpmailer->ClearAllRecipients(); $phpmailer->ClearAttachments(); $phpmailer->ClearBCCs(); $phpmailer->ClearCCs(); $phpmailer->ClearCustomHeaders(); $phpmailer->ClearReplyTos(); // From email and name // If we don't have a name from the input headers if (!isset($from_name)) { $from_name = 'WordPress'; } /* If we don't have an email from the input headers default to wordpress@$sitename * Some hosts will block outgoing mail from this address if it doesn't exist but * there's no easy alternative. Defaulting to admin_email might appear to be another * option but some hosts may refuse to relay mail from an unknown domain. See * http://trac.wordpress.org/ticket/5007. */ if (!isset($from_email)) { // Get the site domain and get rid of www. $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } $from_email = 'wordpress@' . $sitename; } // Plugin authors can override the potentially troublesome default $phpmailer->From = apply_filters('wp_mail_from', $from_email); $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name); // Set destination addresses if (!is_array($to)) { $to = explode(',', $to); } foreach ((array) $to as $recipient) { try { // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>" $recipient_name = ''; if (preg_match('/(.+)\\s?<(.+)>/', $recipient, $matches)) { if (count($matches) == 3) { $recipient_name = $matches[1]; $recipient = $matches[2]; } } $phpmailer->AddAddress(trim($recipient), $recipient_name); } catch (phpmailerException $e) { continue; } } // If we don't have a charset from the input headers if (!isset($charset)) { $charset = get_bloginfo('charset'); } // Set the content-type and charset $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset); // Set mail's subject and body $phpmailer->Subject = $subject; if (is_string($message)) { $phpmailer->Body = $message; // Set Content-Type and charset // If we don't have a content-type from the input headers if (!isset($content_type)) { $content_type = 'text/plain'; } $content_type = apply_filters('wp_mail_content_type', $content_type); $phpmailer->ContentType = $content_type; // Set whether it's plaintext, depending on $content_type if ('text/html' == $content_type) { $phpmailer->IsHTML(true); } // For backwards compatibility, new multipart emails should use // the array style $message. This never really worked well anyway if (false !== stripos($content_type, 'multipart') && !empty($boundary)) { $phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary)); } } elseif (is_array($message)) { foreach ($message as $type => $bodies) { foreach ((array) $bodies as $body) { if ($type === 'text/html') { $phpmailer->Body = $body; } elseif ($type === 'text/plain') { $phpmailer->AltBody = $body; } else { $phpmailer->AddAttachment($body, '', 'base64', $type); } } } } // Add any CC and BCC recipients if (!empty($cc)) { foreach ((array) $cc as $recipient) { try { // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>" $recipient_name = ''; if (preg_match('/(.+)\\s?<(.+)>/', $recipient, $matches)) { if (count($matches) == 3) { $recipient_name = $matches[1]; $recipient = $matches[2]; } } $phpmailer->AddCc(trim($recipient), $recipient_name); } catch (phpmailerException $e) { continue; } } } if (!empty($bcc)) { foreach ((array) $bcc as $recipient) { try { // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>" $recipient_name = ''; if (preg_match('/(.+)\\s?<(.+)>/', $recipient, $matches)) { if (count($matches) == 3) { $recipient_name = $matches[1]; $recipient = $matches[2]; } } $phpmailer->AddBcc(trim($recipient), $recipient_name); } catch (phpmailerException $e) { continue; } } } // Set to use PHP's mail() $phpmailer->IsMail(); // Set custom headers if (!empty($headers)) { foreach ((array) $headers as $name => $content) { $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content)); } } if (!empty($attachments)) { foreach ($attachments as $attachment) { try { $phpmailer->AddAttachment($attachment); } catch (phpmailerException $e) { continue; } } } do_action_ref_array('phpmailer_init', array(&$phpmailer)); // Send! try { $phpmailer->Send(); } catch (phpmailerException $e) { return false; } return true; }
/** * Send email(s). * * @since 2.5.0 * * @param BP_Email $email Email to send. * @return bool|WP_Error Returns true if email send, else a descriptive WP_Error. */ public function bp_email(BP_Email $email) { static $phpmailer = null; if ($phpmailer === null) { if (!class_exists('PHPMailer')) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; } $phpmailer = new PHPMailer(true); } /* * Resets. */ $phpmailer->clearAllRecipients(); $phpmailer->clearAttachments(); $phpmailer->clearCustomHeaders(); $phpmailer->clearReplyTos(); $phpmailer->Sender = ''; /* * Set up. */ $phpmailer->IsMail(); $phpmailer->CharSet = bp_get_option('blog_charset'); $phpmailer->Hostname = self::get_hostname(); /* * Content. */ $phpmailer->Subject = $email->get_subject('replace-tokens'); $content_plaintext = PHPMailer::normalizeBreaks($email->get_content_plaintext('replace-tokens')); if ($email->get('content_type') === 'html') { $phpmailer->msgHTML($email->get_template('add-content'), '', 'wp_strip_all_tags'); $phpmailer->AltBody = $content_plaintext; } else { $phpmailer->IsHTML(false); $phpmailer->Body = $content_plaintext; } $recipient = $email->get_from(); try { $phpmailer->SetFrom($recipient->get_address(), $recipient->get_name(), false); } catch (phpmailerException $e) { } $recipient = $email->get_reply_to(); try { $phpmailer->addReplyTo($recipient->get_address(), $recipient->get_name()); } catch (phpmailerException $e) { } $recipients = $email->get_to(); foreach ($recipients as $recipient) { try { $phpmailer->AddAddress($recipient->get_address(), $recipient->get_name()); } catch (phpmailerException $e) { } } $recipients = $email->get_cc(); foreach ($recipients as $recipient) { try { $phpmailer->AddCc($recipient->get_address(), $recipient->get_name()); } catch (phpmailerException $e) { } } $recipients = $email->get_bcc(); foreach ($recipients as $recipient) { try { $phpmailer->AddBcc($recipient->get_address(), $recipient->get_name()); } catch (phpmailerException $e) { } } $headers = $email->get_headers(); foreach ($headers as $name => $content) { $phpmailer->AddCustomHeader($name, $content); } /** * Fires after PHPMailer is initialised. * * @since 2.5.0 * * @param PHPMailer $phpmailer The PHPMailer instance. */ do_action('bp_phpmailer_init', $phpmailer); /** This filter is documented in wp-includes/pluggable.php */ do_action_ref_array('phpmailer_init', array(&$phpmailer)); try { return $phpmailer->Send(); } catch (phpmailerException $e) { return new WP_Error($e->getCode(), $e->getMessage(), $email); } }
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // we use GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server $mail->Username = "******"; // GMAIL username $mail->Password = "******"; // GMAIL password $mail->SetFrom('*****@*****.**', $email); $mail->Subject = "Helios - " . $subject; $mail->AltBody = "To view the message, please use an HTML compatible mail viewer!"; // optional, comment out and test $mail->AddAddress('*****@*****.**'); $mail->AddCc('*****@*****.**'); if (!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { if (save_record($salutation, $name, $title, $company, $industry, $code1, $code2, $region, $phone, $mobile, $email, $subject, $message, $datepost)) { $end_message = "<div class='alert alert-success alert-dismissable'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tThank you. your comment has been saved! </div>"; } else { $end_message = "<div class='alert alert-warning alert-dismissable'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t <strong>Sorry! </strong>your comment is not saved!</div>"; } } } } ?> <div class="container overview2"> <div class="container overviewmidle"> <div class="col-lg-12">