| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/home2/mommybites/ |
Upload File : |
<?php
require_once 'wp-config.php';
require_once 'PHPMailer-master/PHPMailerAutoload.php';
define('PHPM_SMTP_HOST', 'us-smtp-outbound-1.mimecast.com');
define('PHPM_SMTP_AUTHENTICATION', false);
define('PHPM_SMTP_USERNAME', '');
define('PHPM_SMTP_PASSWORD', '');
define('PHPM_SMTP_ENCRYPTION', 'tls');
define('PHPM_SMTP_PORT', 25);
define('PHPM_BCC', array(''));
define('PHPM_DEV_BCC', array(''));
define('PHPM_DEV_TO', '');
/**
* send out an email
*
* @param String $to - email address to send message to
* @param String $from - the from email address
* @param String $subject - the subject
* @param String $message - the message
* @param array $arCC - array of cc
* @param array $arBCC - array of bcc
* @param array $extras - additional data
* @return boolean
*/
function sendSimpleEmail($to,$from,$subject,$message,$arCC=array(),$arBCC=array(),$extras=array())
{
global $wpdb;
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$from_email = $from;
$from = (!$from OR $from=='')?'[email protected]':$from;
$from_name = ($extras['from_name']=='')?'Mommybites':$extras['from_name'];
$reply_email = $from;
$reply_name = $from_name;
$mail->isSMTP();
$mail->Host = PHPM_SMTP_HOST;
$mail->SMTPAuth = PHPM_SMTP_AUTHENTICATION;
$mail->Username = PHPM_SMTP_USERNAME;
$mail->Password = PHPM_SMTP_PASSWORD;
$mail->SMTPSecure = PHPM_SMTP_ENCRYPTION;
$mail->Port = PHPM_SMTP_PORT;
$mail->headerLine('Content-Type','text/html; charset=UTF-8');
$mail->isHTML(true);
$mail->setFrom($from, $from_name);
$mail->addReplyTo($reply_email, $reply_name);
foreach ($arCC as $value) {
$mail->addCC($value);
}
foreach ($arBCC as $value) {
$mail->addBCC($value);
}
$message .= '
<img src="https://www.google-analytics.com/collect?v=1&tid=UA-9331324-8&cid=4343&t=event&ec=email&ea=open&el=mommybites&cs=simple_email&cm=email" />';
//$mail->addAttachment('/var/tmp/file.tar.gz');
$arTo = explode(',', $to);
$arTo = array_map("trim", $arTo);
foreach ($arTo as $value) {
$mail->addAddress($value);
}
$mail->Subject = $subject;
$mail->Body = $message;
if(!$mail->send()) {
//echo 'Email could not be sent: ' . __CLASS__ . '::' . __FUNCTION__ . ' ' . ' LINE: ' . __LINE__ .$mail->ErrorInfo;
error_log('Email could not be sent: ' . __CLASS__ . '::' . __FUNCTION__ . ' ' . ' LINE: ' . __LINE__ .( $mail->ErrorInfo ) );
return false;
} else {
$data['email_address']=$to;
$data['subject']=$subject;
$data['message']=$message;
$data['created_datetime']=date("Y-m-d H:i:s");
$wpdb->insert('email_log',$data);
return true;
}
}
?>