/** * Send the mail. * * @param Midas_Mail $mail mail instance * @throws Midas_Service_AppEngine_Exception */ public function sendMail(Midas_Mail $mail) { if (is_null($this->_client)) { $this->_client = new \google\appengine\api\mail\Message(); } $this->_client->addBcc($mail->getBcc()); $this->_client->addCc($mail->getCc()); $this->_client->addTo($mail->getTo()); $this->_client->setHtmlBody($mail->getBodyHtml(true)); $this->_client->setReplyTo($mail->getReplyTo()); $this->_client->setSender($mail->getFrom()); $this->_client->setSubject($mail->getSubject()); $this->_client->setTextBody($mail->getBodyText(true)); try { $this->_client->send(); } catch (\Exception $exception) { throw new Midas_Service_AppEngine_Exception($exception); } }
/** * Send an email. * * This is a re-implementation of PHP's mail() function using App Engine * mail API. The function relies on mailparse extension to parse emails. * * @param string $to Receiver, or receivers of the mail. * @param string $subject Subject of the email to be sent. * @param string $message Message to be sent. * @param string $additional_headers optional * String to be inserted at the end of the email header. * @param string $additional_parameters optional * Additional flags to be passed to the mail program. This arugment is * added only to match the signature of PHP's mail() function. The value is * always ignored. * @return bool * TRUE if the message is sent successfully, otherwise return FALSE. * * @see http://php.net/mail */ public static function sendMail($to, $subject, $message, $additional_headers = null, $additional_parameters = null) { $raw_mail = "To: {$to}\r\nSubject: {$subject}\r\n"; if ($additional_headers != null) { $raw_mail .= trim($additional_headers); } $raw_mail .= "\r\n\r\n{$message}"; $mime = mailparse_msg_create(); mailparse_msg_parse($mime, $raw_mail); $root_part = mailparse_msg_get_part_data($mime); // Set sender address based on the following order // 1. "From" header in $additional_headers // 2. "sendmail_from" ini setting // 3. Default address "mailer@<app-id>.appspotmail.com $from = ini_get('sendmail_from'); if (isset($root_part['headers']['from'])) { $from = $root_part['headers']['from']; } if ($from === false || $from == "") { $from = sprintf(self::DEFAULT_SENDER_ADDRESS_FORMAT, AppIdentityService::getApplicationId()); syslog(LOG_WARNING, "mail(): Unable to determine sender's email address from the " . "'sendmail_from' directive in php.ini or from the 'From' " . "header. Falling back to the default {$from}."); } $email = new Message(); try { $email->setSender($from); $email->addTo($root_part['headers']['to']); if (isset($root_part['headers']['cc'])) { $email->AddCc($root_part['headers']['cc']); } if (isset($root_part['headers']['bcc'])) { $email->AddBcc($root_part['headers']['bcc']); } $email->setSubject($root_part['headers']['subject']); $parts = mailparse_msg_get_structure($mime); if (count($parts) > 1) { foreach ($parts as $part_id) { $part = mailparse_msg_get_part($mime, $part_id); self::parseMimePart($part, $raw_mail, $email); } } else { if ($root_part['content-type'] == 'text/plain') { $email->setTextBody($message); } else { if ($root_part['content-type'] == 'text/html') { $email->setHtmlBody($message); } } } $email->send(); } catch (\Exception $e) { trigger_error('mail(): ' . $e->getMessage(), E_USER_WARNING); return false; } return true; }
function sendMail($email, $url) { try { $message = new Message(); $message->setSender("*****@*****.**"); $message->addTo($email); $message->setSubject("Forgot Password"); $message->setTextBody('Please visit the following link to reset your password. ' . $url); $message->send(); } catch (InvalidArgumentException $e) { // ... } }
public function getTempTableDrop($trg_UserStamp) { $temptableflag=0; $this->load->model('EILIB/Mdl_eilib_common_function'); $emaillistarray = $this->Mdl_eilib_common_function->getProfileEmailId('DROPTABLE'); $name = $emaillistarray[0]; $cclist = $emaillistarray[1]; $username = explode('@', $name); $mailusername = strtoupper($username[0]); $emailtempquery = "SELECT *FROM EMAIL_TEMPLATE_DETAILS WHERE ET_ID=14"; $emailtempresult = $this->db->query($emailtempquery); foreach ($emailtempresult->result_array() as $key => $value) { $emailsub = $value["ETD_EMAIL_SUBJECT"]; $subject = $value["ETD_EMAIL_BODY"]; } $currentmonth = date("Ymd"); $CURRENT_MONTH = date('d-F-Y', strtotime($currentmonth)); $InstanceName=$this->Mdl_eilib_common_function->getInstanceName(); $schema_name=$this->Mdl_eilib_common_function->getSchemaName(); $emailsub = str_replace('CURRENTDATE', $CURRENT_MONTH, $emailsub); $emailsub = str_replace('INSTANCENAME', $InstanceName, $emailsub); $emailsub = str_replace('SCHEMANAME', $schema_name, $emailsub); $emailsub = strtoupper($emailsub); $subject = str_replace('CURRENTDATE', $CURRENT_MONTH, $subject); $subject = str_replace('[INSTANCENAME]', $InstanceName, $subject); $subject = str_replace('[SCHEMANAME]', $schema_name, $subject); $subject = strtoupper($subject); $message = '<body><br><h> ' . $subject . '</h><br><br><table border="1" width="500" hieght="20"><tr bgcolor="#6495ed" style="color:white" align="center" ><td width=25%><h3>TEMP TABLE NAME(S)</h3></td></tr></table></body>'; $this->db->query("CALL SP_DROP_PROD_TEMP_TABLE('$schema_name','$trg_UserStamp',@FINALTABLE)"); $temtable_result = $this->db->query("SELECT @FINALTABLE AS TEMPTABLE"); $TEMPLTABLE = $temtable_result->row()->TEMPTABLE; $temptableresult = $this->db->query("SELECT *FROM " . $TEMPLTABLE); foreach ($emailtempresult->result_array() as $key => $value) { $temptableflag = 1; $message .= '<body><table border="1" width="500" ><tr align="left" ><td align="center" width=40%>'.$value['DROPTABLENAME'].'</td></tr></table></body>'; } if($temptableflag==1) { $EmailDisplayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('DROP_TEMP_TABLE'); $this->db->query('DROP TABLE IF EXISTS ' . $TEMPLTABLE); $message1 = new Message(); $message1->setSender($EmailDisplayname.'<'.$trg_UserStamp.'>'); $message1->addTo($name); $message1->addCC($cclist); $message1->setSubject($emailsub); $message1->setHtmlBody($message); $message1->send(); } }
function contact() { if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["email"] && $_POST["subject"] && $_POST["content"]) { $msg = new Message(); $msg->setSender("*****@*****.**"); $msg->addTo("*****@*****.**"); $msg->setSubject("[NKR] " . $_POST["subject"]); $msg->setTextBody($_POST["email"] . "\n\n" . $_POST["content"]); $msg->send(); } else { http_response_code(422); } } }
function contact() { if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["email"] && $_POST["subject"] && $_POST["content"]) { $msg = new Message(); $msg->setSender("*****@*****.**"); $msg->addTo("*****@*****.**"); $msg->setSubject("[MrKimOnTour] " . $_POST["subject"]); $msg->setTextBody($_POST["email"] . "\n\n" . $_POST["content"]); $msg->send(); } else { http_response_code(422); } } }
public function CWEXP_get_customerdetails(){ $UserStamp=$this->Mdl_eilib_common_function->getSessionUserStamp(); $timeZoneFormat=$this->Mdl_eilib_common_function->getTimezone(); $CWEXP_weekBefore=$_POST["CWEXP_TB_weekBefore"]; $CWEXP_email_id=$_POST["CWEXP_email"]; $final_value=$this->Mdl_customer_expiry_list->CWEXP_get_customerdetails($CWEXP_weekBefore,$CWEXP_email_id,$UserStamp,$timeZoneFormat); if($final_value[0]==1) { $displayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('CUSTOMER_EXPIRY'); $message1 = new Message(); $message1->setSender($displayname.'<'.$UserStamp.'>'); $message1->addTo($CWEXP_email_id); $message1->setSubject($final_value[2]); $message1->setHtmlBody($final_value[1]); $message1->send(); $CWEXP_check_weekly_expiry_list='true'; echo ($CWEXP_check_weekly_expiry_list); } else{ $CWEXP_check_weekly_expiry_list='false'; echo ($CWEXP_check_weekly_expiry_list); } }
public function Customercreationmailpart($Confirm_Meessage,$Emailsub,$Messagebody,$Displayname,$Sendmailid,$UserStamp) { $message1 = new Message(); $message1->setSender($Displayname.'<'.$UserStamp.'>'); $message1->addTo($Sendmailid); $message1->setSubject($Emailsub); $message1->setHtmlBody($Messagebody); $message1->send(); // $this->db->trans_commit(); return $Confirm_Meessage; }
/** * Send email * * This is based on {@see wp_mail()} which is in turn based on PHP's * built-in mail() function. This is typically called from the overriden * version of {@see wp_mail()} below. * * @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 send_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'))); global $phpmailer; if (!is_object($phpmailer) || !is_a($phpmailer, 'Message')) { $phpmailer = new Message(); } $cc = array(); $bcc = array(); // 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 (false === strpos($header, ':')) { 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 (false !== strpos($content, '<')) { // 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 (false !== strpos($content, ';')) { 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->clearBcc(); $phpmailer->clearCc(); $phpmailer->clearReplyTo(); $phpmailer->clearTo(); // From email and name // If we don't have a name from the input headers if (!isset($from_name)) { $from_name = 'App Engine'; } /* 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)) { $from_email = get_option('appengine_email', false); if (!$from_email) { $from_email = get_default_email(); } } // Plugin authors can override the potentially troublesome default // TODO: Currently, App Engine doesn't support a from name. We should // come back to this and fix it if/when it does //$phpmailer->setSender( apply_filters( 'wp_mail_from_name', $from_name ) . " <" . apply_filters( 'wp_mail_from', $from_email ) . ">"); $phpmailer->setSender(apply_filters('wp_mail_from', $from_email)); // 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->addTo($recipient, $recipient_name); } catch (Exception $e) { syslog(LOG_DEBUG, 'Mail error: ' . $e->getMessage()); continue; } } // Add any CC and BCC recipients $cc = array_filter($cc); $bcc = array_filter($bcc); 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 (Exception $e) { syslog(LOG_DEBUG, 'Mail error: ' . $e->getMessage()); 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 (Exception $e) { syslog(LOG_DEBUG, 'Mail error: ' . $e->getMessage()); continue; } } } // 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, depending on $content_type if ('text/html' == $content_type) { $phpmailer->setHtmlBody($message); } else { $phpmailer->setTextBody($message); } $phpmailer->setSubject($subject); // 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->charsset = apply_filters( 'wp_mail_charset', $charset ); // Set custom headers if (!empty($headers)) { if (isset($headers['MIME-Version'])) { unset($headers['MIME-Version']); } $phpmailer->addHeaderArray($headers); if (false !== stripos($content_type, 'multipart') && !empty($boundary)) { $phpmailer->addHeaderArray('Content-Type', sprintf("%s;\n\t boundary=\"%s\"", $content_type, $boundary)); } } if (!empty($attachments)) { foreach ($attachments as $attachment) { try { $name = basename($attachment); $data = file_get_contents($attachment); $phpmailer->addAttachment($name, $data); } catch (Exception $e) { syslog(LOG_DEBUG, 'Mail error: ' . $e->getMessage()); continue; } } } // Send! $phpmailer->send(); return true; }
<?php use google\appengine\api\mail\Message; $name = htmlspecialchars($_POST["name"]); $email = htmlspecialchars($_POST["email"]); $message = htmlspecialchars($_POST["message"]); $subject = "Feedback received from: " . $name; $emailBody = "From: " . $name . "\nEmail: " . $email . "\n\nMessage:\n" . $message; try { $message = new Message(); $message->setSender("*****@*****.**"); $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); $message->setSubject($subject); $message->setTextBody($emailBody); $message->send(); } catch (InvalidArgumentException $e) { echo $e; } echo "complete";
} $email_message = <<<EMAIL guest1: {$submitted['guest1']} guest2: {$submitted['guest2']} coming: {$submitted['coming']} meal_beef: {$submitted['meal_beef']} meal_fish: {$submitted['meal_fish']} meal_veggie: {$submitted['meal_veggie']} dietary_restrictions: {$submitted['dietary_restrictions']} brunch: {$submitted['brunch']} song: {$submitted['song']} message: {$submitted['message']} EMAIL; try { $message = new Message(); $message->setSender('*****@*****.**'); $message->addTo('*****@*****.**'); $message->setSubject("RSVP to Beth & Ian's Wedding"); $message->setTextBody($email_message); if (!empty($selfie)) { $message->addAttachment($selfie['name'], $selfie['data']); } $message->send(); include 'views/thankyou.php'; } catch (Exception $e) { $error_message = <<<HTML Couldn't send your message to Beth & Ian. The following error occurred:<br><br> {$e} HTML; include 'views/error.php';
} $drop_query="DROP TABLE $temp_table_name "; $drop_query1="DROP TABLE $temp_table_name1 "; mysqli_query($con,$drop_query); mysqli_query($con,$drop_query1); $message=$message."</table></body></html>"; $find='SSOMENS TIME SHEET REPORT- '.$month_year; $messagepdf=str_replace($find,'',$message); $find1='HELLO '.$spladminname; $messagepdf=str_replace($find1,'<b>'.'SSOMENS TIME SHEET REPORT- '.$month_year.'</b>',$messagepdf); $find2='SSOMENS TIME SHEET REPORT FOR THE FOLLOWING EMPLOYEE(S) - '.$month_year.':'; $messagepdf=str_replace($find2,'',$messagepdf); ob_clean(); $mpdf = new mPDF('utf-8',array(270,330)); $mpdf->WriteHTML($messagepdf); $outputpdf=$mpdf->Output('SSOMENS TS REPORT ' .$month_year. '.pdf','s'); ob_end_clean(); $FILENAME='SSOMENS TS REPORT ' .$month_year. '.pdf'; $message1 = new Message(); $message1->setSender($admin); $message1->addTo($admin); $message1->addCc($sadmin); $message1->setSubject($mail_subject); $message1->setHtmlBody($message); $message1->addAttachment($FILENAME,$outputpdf); $message1->send(); }
$columns = implode(", ", array_keys($insert_update_array)); $escaped_values = array_map('mysql_real_escape_string', array_values($insert_update_array)); //$values = implode(", ", $escaped_values); $values = implode("', '", $escaped_values); $query1 = "INSERT INTO `website_users`({$columns}) VALUES ('{$values}')"; $result2 = mysql_query($query1); if (!$result2) { die('Invalid query: ' . mysql_error()); } // done // Notice that $image_content_id is the optional Content-ID header value of the // attachment. Must be enclosed by angle brackets (<>) // Notice that $image_data is the raw file data of the attachment. try { $message = new Message(); $message->setSender("*****@*****.**"); $message->addTo($email); $message->setSubject("Confirm your Buy 4 Square email address"); $message->setTextBody('Confirm your e-mail address https://buy4square.appspot.com/confirm-email.php?username='******'&code?' . $email_code . ''); $message->send(); } catch (InvalidArgumentException $e) { // ... } $success = '<div class="alert alert-success">You Created an account, please sign in.</div>'; } } } } // Inialize session $form_username = ''; $form_password = '';
public function CustomerUpdatemailpart($Confirm_Meessage,$Emailsub,$Messagebody,$Displayname,$Docowner,$UserStamp) { $message1 = new Message(); $message1->setSender($Displayname.'<'.$UserStamp.'>'); $message1->addTo($Docowner); $message1->setSubject($Emailsub); $message1->setHtmlBody($Messagebody); $message1->send(); echo $Confirm_Meessage; exit; }
public function Expirymailpart($CWEXP_emailid,$CWEXP_subject,$CWEXP_emailmessage,$displayname,$UserStamp) { $message1 = new Message(); $message1->setSender($displayname.'<'.$UserStamp.'>'); $message1->addTo($CWEXP_emailid); $message1->setSubject($CWEXP_subject); $message1->setHtmlBody($CWEXP_emailmessage); $message1->send(); }
<?php use google\appengine\api\mail\Message; $title = "Contact"; $breadcrumbs = array(array("title" => "Contact", "link" => "/contact")); $msgAlert = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["email"] && $_POST["subject"] && $_POST["content"]) { $msg = new Message(); $msg->setSender("*****@*****.**"); $msg->addTo("*****@*****.**"); $msg->setSubject("[MrKimOnTour] " . $_POST["subject"]); $msg->setTextBody($_POST["email"] . "\n\n" . $_POST["content"]); $msg->send(); $msgAlert = <<<END <div class="alert alert-success"> Your email has been sent. </div> END; } else { $msgAlert = <<<END <div class="alert alert-warning"> All fields are required. </div> END; } } $content = <<<END {$msgAlert}
function sendMail($msg, $sub = "zouk-calendar app") { try { $message = new Message(); $message->setSender("*****@*****.**"); //$message->setSender("*****@*****.**"); $message->addTo("*****@*****.**"); $message->setSubject($sub); $message->setTextBody($msg); $message->send(); } catch (InvalidArgumentException $e) { syslog(LOG_ERR, "Email send failed: " . $e); } }
<?php if (!isset($_POST)) { exit; } use google\appengine\api\mail\Message; $mensajeCuerpo = array(); $mensajeCuerpo[] = "Nombre y Apellido: " . $_POST['var_name']; $mensajeCuerpo[] = "Email: " . $_POST['var_mail']; $mensajeCuerpo[] = "Telefono: " . $_POST['var_phone']; $mensajeCuerpo[] = "Empresa: " . $_POST['var_empresa']; $mensajeCuerpo[] = "Cargo: " . $_POST['var_cargo']; $mensajeCuerpo[] = "Consulta: " . $_POST['var_comments']; $mensajeCuerpo = implode("\n", $mensajeCuerpo); // Notice that $image_content_id is the optional Content-ID header value of the // attachment. Must be enclosed by angle brackets (<>) //$image_content_id = '<image-content-id>'; // Notice that $image_data is the raw file data of the attachment. try { $message = new Message(); $message->setSender("*****@*****.**"); $message->addTo("*****@*****.**"); $message->setSubject("Consulta Web"); $message->setTextBody($mensajeCuerpo); //$message->addAttachment('image.jpg', $image_data, $image_content_id); $message->send(); print "ok"; } catch (InvalidArgumentException $e) { print "error"; }
public function OPL_list_creation($UserStamp) { try { $period = $_POST['FIN_OPL_db_period']; $mailid = $_POST['FIN_OPL_lb_mailid']; $MailidSplit = explode('@', $mailid); $Username = strtoupper($MailidSplit[0]); $Maildate = strtoupper($period); $Option = $_POST['Radio']; if ($Option == 'OPL_list') { $EmilTemplateSelectQuery = "SELECT ETD_EMAIL_SUBJECT,ETD_EMAIL_BODY FROM EMAIL_TEMPLATE_DETAILS WHERE ET_ID=6"; $result = $this->db->query($EmilTemplateSelectQuery); foreach ($result->result_array() as $key => $val) { $Email_sub = $val['ETD_EMAIL_SUBJECT']; $Email_Body = $val['ETD_EMAIL_BODY']; } $flag = 0; $Email_sub = str_replace("[MM-YYYY]", $Maildate, $Email_sub); $Email_Body = str_replace("[MM-YYYY]", $Maildate, $Email_Body); $Email_Body = str_replace("[MAILID_USERNAME]", $Username, $Email_Body); $FIN_OPL_message = '<body><br><h> ' . $Email_Body . '</h><br><br><table border="1" style="color:white" width="800"><tr bgcolor=" #498af3" align="center" ><td width=50%><h3>UNIT-CUSTOMER</h3></td><td width=15%><h3>RENT</h3></td><td width=15%><h3>DEPOSIT</h3></td><td width=20%><h3>PROCESSING FEE</h3></td></tr></table></body>'; $OPLSelectQuery = "CALL SP_OUTSTANDING_PAYMENTLIST('$period','$UserStamp',@TEMP_FINAL_NONPAIDCUSTOMER)"; $this->db->query($OPLSelectQuery); $outparm_query = 'SELECT @TEMP_FINAL_NONPAIDCUSTOMER AS TEMP_TABLE'; $outparm_result = $this->db->query($outparm_query); $csrc_tablename = $outparm_result->row()->TEMP_TABLE; $FIN_OPL_listquery = "SELECT *FROM $csrc_tablename ORDER BY UNIT_NO,CUSTOMERNAME"; $result = $this->db->query($FIN_OPL_listquery); foreach ($result->result_array() as $key => $value) { $flag = 1; $unit = $value["UNIT_NO"]; $customername = $value["CUSTOMERNAME"]; $enddate = $value["FINAL_ENDDATE"]; $payment = $value["PAYMENT"]; if ($payment == "NULL") { $payment = " "; } $deposit = $value["DEPOSIT"]; if ($deposit == "NULL") { $deposit = " "; } $process = $value["PROCESSINGFEE"]; if ($process == "NULL") { $process = " "; } $enddateflag=0; if ($enddate != null) { $enddateflag=1; $enddate = date('d-m-Y', strtotime($enddate)); $opldataname = $unit . '-' . $customername.' - '.$enddate; } else { $opldataname = $unit . '-' . $customername; } $opldataname = str_replace('_', ' ', $opldataname); if (($payment == 'X') && ($deposit == "X") && ($process == "X") && $enddateflag==0) { $FIN_OPL_message .= '<body><table border="1"width="800" ><tr><td bgcolor="#FF0000" width="50%">' . $opldataname . '</td><td width=15% align="center">' . $payment . '</td><td width=15% align="center">' . $deposit . '</td><td width=20% align="center">' . $process . '</td></tr></table></body>'; } else if($enddateflag==1) { $FIN_OPL_message .= '<body><table border="1"width="800" ><tr><td width="50%"><span style="background-color:red;color:white">' . $opldataname . '</span></td><td width=15% align="center">' . $payment . '</td><td width=15% align="center">' . $deposit . '</td><td width=20% align="center">' . $process . '</td></tr></table></body>'; } else { $FIN_OPL_message .= '<body><table border="1"width="800" ><tr><td width="50%">' . $opldataname . '</td><td width=15% align="center">' . $payment . '</td><td width=15% align="center">' . $deposit . '</td><td width=20% align="center">' . $process . '</td></tr></table></body>'; } } $this->db->query('DROP TABLE IF EXISTS ' . $csrc_tablename); $this->load->model('EILIB/Mdl_eilib_common_function'); $EmailDisplayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('OUTSTANDING_PAYEES'); $confirmessage='opllist'; if($flag!=1) { $FIN_OPL_message = "THERE IS NO OUTSTANDING PAYEES FOR <MONTH-YEAR>"; $FIN_OPL_message = str_replace("<MONTH-YEAR>", $period, $FIN_OPL_message); $confirmessage='emptylist'; } $message1 = new Message(); $message1->setSender($EmailDisplayname . '<' . $UserStamp . '>'); $message1->addTo($mailid); $message1->setSubject($Email_sub); $message1->setHtmlBody($FIN_OPL_message); $message1->send(); echo $confirmessage; exit; } else { $flag = 1; $period = $_POST['FIN_OPL_db_period']; $activecclist = "CALL SP_ACTIVE_CUSTOMERLIST('$period','$UserStamp',@TEMP_OPL_ACTIVECUSTOMER_TABLE,@TEMP_OPL_SORTEDACTIVECUSTOMER_TABLE)"; $this->db->query($activecclist); $outparm_query = 'SELECT @TEMP_OPL_ACTIVECUSTOMER_TABLE AS TEMP_TABLE1,@TEMP_OPL_SORTEDACTIVECUSTOMER_TABLE AS TEMP_TABLE2'; $outparm_result = $this->db->query($outparm_query); $activelisttablename = $outparm_result->row()->TEMP_TABLE1; $sortactivelisttablename = $outparm_result->row()->TEMP_TABLE2; $FIN_Active_listquery = "SELECT *FROM $activelisttablename ORDER BY UNIT_NO,CUSTOMERNAME"; $result1 = $this->db->query($FIN_Active_listquery); $numrows=$this->db->affected_rows(); $FIN_Active_sortlistquery = "SELECT *FROM $sortactivelisttablename ORDER BY ENDDATE ASC"; $sortresult = $this->db->query($FIN_Active_sortlistquery); $sortnumrows=$this->db->affected_rows(); $headerdata='UNIT,CUSTOMER,STARTDATE,ENDDATE,RENT,DEPOSIT,PROCESSING FEE,TERMINATE,PRE TERMINATE,PRE TERMINATE DATE,COMMENTS'; $FIN_ACT_folresult=$this->db->query("SELECT PCN_DATA FROM PAYMENT_CONFIGURATION WHERE CGN_ID=49"); $folderid=$FIN_ACT_folresult->row()->PCN_DATA; $this->load->library('Google'); $this->load->model('EILIB/Mdl_eilib_common_function'); $EmailDisplayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('ACTIVE_CC_LIST'); $service = $this->Mdl_eilib_common_function->get_service_document(); $this->load->model('EILIB/Mdl_eilib_common_function'); $SS_name='ACTIVE CUST LIST'.'-'.date("dmY"); $FILEID=$this->Mdl_eilib_common_function->NewSpreadsheetCreationwithurl($service,$SS_name, 'CUSTOMER_DETAILS', $folderid); $ActiveCustomerList = array('ACtiveflag'=>10,'header'=>$headerdata,"Rows"=>$numrows,"period"=>$period,"SortRows"=>$sortnumrows,"Fileid"=>$FILEID[0]); $i = 0; foreach ($result1->result_array() as $key => $value) { $key = 'data'.$i; $unit = $value["UNIT_NO"]; $customername = $value["CUSTOMERNAME"]; $Startdate = $value["STARTDATE"]; $Enddate = $value["ENDDATE"]; $Payment = $value["PAYMENT_AMOUNT"]; $Deposit = $value["DEPOSIT"]; $ProcessingFee = $value['PROCESSING_FEE']; $Terminate = $value['CLP_TERMINATE']; $Preterminate = $value['PRETERMINATE']; $Preterminatedate = $value['PRETERMINATEDATE']; $Comments = $value['COMMENTS']; $data = $unit . '!~' . $customername . '!~' . $Startdate . '!~' . $Enddate . '!~' . $Payment . '!~' . $Deposit . '!~' . $ProcessingFee . '!~' . $Terminate . '!~' . $Preterminate . '!~' . $Preterminatedate . '!~' . $Comments; $ActiveCustomerList[$key] = $data; $i++; } $i = 0; foreach ($sortresult->result_array() as $key => $value) { $key = 'sortdata'.$i; $unit = $value["UNIT_NO"]; $customername = $value["CUSTOMERNAME"]; $Startdate = $value["STARTDATE"]; $Enddate = $value["ENDDATE"]; $Payment = $value["PAYMENT_AMOUNT"]; $Deposit = $value["DEPOSIT"]; $ProcessingFee = $value['PROCESSING_FEE']; $Terminate = $value['CLP_TERMINATE']; $Preterminate = $value['PRETERMINATE']; $Preterminatedate = $value['PRETERMINATEDATE']; $Comments = $value['COMMENTS']; $data = $unit . '!~' . $customername . '!~' . $Startdate . '!~' . $Enddate . '!~' . $Payment . '!~' . $Deposit . '!~' . $ProcessingFee . '!~' . $Terminate . '!~' . $Preterminate . '!~' . $Preterminatedate . '!~' . $Comments; $ActiveCustomerList[$key] = $data; $i++; } $this->db->query('DROP TABLE IF EXISTS ' . $activelisttablename); $this->db->query('DROP TABLE IF EXISTS ' . $sortactivelisttablename); $Returnvalue=$this->Mdl_eilib_common_function->Func_curl($ActiveCustomerList); $subject='ACTIVE CUST LIST-'.date("dmY"); $mailbody ="HELLO ".$Username; $mailbody=$mailbody.''.'<br><br>, PLEASE FIND ATTACHED THE CURRENT : '.$FILEID[1]; $message1 = new Message(); $message1->setSender($EmailDisplayname . '<' . $UserStamp . '>'); $message1->addTo($mailid); $message1->setSubject($subject); $message1->setHtmlBody($mailbody); $message1->send(); echo 'ACTIVECCLIST'; exit; } } catch (Exception $e) { return $e->getMessage(); } }
$result = $select->fetch_assoc(); $temp_table_name = $result['@TEMP_CLOCK_OUT_MISSED_DETAILS']; $select_data = "select * from {$temp_table_name} ORDER BY EMPLOYEE_NAME "; $select_data_rs = mysqli_query($con, $select_data); $row = mysqli_num_rows($select_data_rs); $x = $row; if ($x > 0) { while ($row = mysqli_fetch_array($select_data_rs)) { $adm_employeename = $row["EMPLOYEE_NAME"]; $adm_date = $row["REPORT_DATE"]; $message = $message . "<tr><td width=220>" . $adm_employeename . "</td><td width=150>" . $adm_date . "</td></tr>"; } $message = $message . "</table></body></html>"; $REP_subject_date = $mail_subject; //SENDING MAIL OPTIONS $name = $mail_subject; $from = $admin; $message1 = new Message(); $message1->setSender($name . '<' . $from . '>'); $message1->addTo($admin); $message1->addCc($sadmin); $message1->setSubject($REP_subject_date); $message1->setHtmlBody($message); try { $message1->send(); } catch (\InvalidArgumentException $e) { echo $e; } } $drop_query = "DROP TABLE {$temp_table_name} "; mysqli_query($con, $drop_query);
public function testSendNoBody() { $message = new Message(); $this->setExpectedException("InvalidArgumentException", "Neither a plain-text nor HTML body is provided - at least one is " . "required."); $message->setSender("*****@*****.**"); $message->addTo("*****@*****.**"); $message->setSubject("test"); $message->send(); }
public function CC_Active_List($UserStamp) { set_time_limit(0); $currentmonth=date("Ymd"); $period=date('F Y', strtotime($currentmonth)); $activecclist = "CALL SP_ACTIVE_CUSTOMERLIST('$period','$UserStamp',@TEMP_OPL_ACTIVECUSTOMER_TABLE,@TEMP_OPL_SORTEDACTIVECUSTOMER_TABLE)"; $this->db->query($activecclist); $outparm_query = 'SELECT @TEMP_OPL_ACTIVECUSTOMER_TABLE AS TEMP_TABLE1,@TEMP_OPL_SORTEDACTIVECUSTOMER_TABLE AS TEMP_TABLE2'; $outparm_result = $this->db->query($outparm_query); $activelisttablename = $outparm_result->row()->TEMP_TABLE1; $sortactivelisttablename = $outparm_result->row()->TEMP_TABLE2; $FIN_Active_listquery = "SELECT *FROM $activelisttablename ORDER BY UNIT_NO,CUSTOMERNAME"; $result1 = $this->db->query($FIN_Active_listquery); $numrows = $this->db->affected_rows(); $FIN_Active_sortlistquery = "SELECT *FROM $sortactivelisttablename ORDER BY ENDDATE ASC"; $sortresult = $this->db->query($FIN_Active_sortlistquery); $sortnumrows = $this->db->affected_rows(); $headerdata = 'UNIT,CUSTOMER,STARTDATE,ENDDATE,RENT,DEPOSIT,PROCESSING FEE,TERMINATE,PRE TERMINATE,PRE TERMINATE DATE,COMMENTS'; $FIN_ACT_folresult = $this->db->query("SELECT PCN_DATA FROM PAYMENT_CONFIGURATION WHERE CGN_ID=49"); $folderid = $FIN_ACT_folresult->row()->PCN_DATA; $this->load->library('Google'); $this->load->model('EILIB/Mdl_eilib_common_function'); $EmailDisplayname = $this->Mdl_eilib_common_function->Get_MailDisplayName('ACTIVE_CC_LIST'); $Sendmailid=$this->Mdl_eilib_common_function->getProfileEmailId('ACTIVE_CC_TRIGGER'); $service = $this->Mdl_eilib_common_function->get_service_document(); $this->load->model('EILIB/Mdl_eilib_common_function'); $SS_name = 'ACTIVE CUST LIST' . '-' . date("dmY"); $FILEID = $this->Mdl_eilib_common_function->NewSpreadsheetCreationwithurl($service, $SS_name, 'CUSTOMER_DETAILS', $folderid); $ActiveCustomerList = array('ACtiveflag' => 10, 'header' => $headerdata, "Rows" => $numrows, "period" => $period, "SortRows" => $sortnumrows, "Fileid" => $FILEID[0]); $i = 0; foreach ($result1->result_array() as $key => $value) { $key = 'data' . $i; $unit = $value["UNIT_NO"]; $customername = $value["CUSTOMERNAME"]; $Startdate = $value["STARTDATE"]; $Enddate = $value["ENDDATE"]; $Payment = $value["PAYMENT_AMOUNT"]; $Deposit = $value["DEPOSIT"]; $ProcessingFee = $value['PROCESSING_FEE']; $Terminate = $value['CLP_TERMINATE']; $Preterminate = $value['PRETERMINATE']; $Preterminatedate = $value['PRETERMINATEDATE']; $Comments = $value['COMMENTS']; $data = $unit . '!~' . $customername . '!~' . $Startdate . '!~' . $Enddate . '!~' . $Payment . '!~' . $Deposit . '!~' . $ProcessingFee . '!~' . $Terminate . '!~' . $Preterminate . '!~' . $Preterminatedate . '!~' . $Comments; $ActiveCustomerList[$key] = $data; $i++; } $i = 0; foreach ($sortresult->result_array() as $key => $value) { $key = 'sortdata' . $i; $unit = $value["UNIT_NO"]; $customername = $value["CUSTOMERNAME"]; $Startdate = $value["STARTDATE"]; $Enddate = $value["ENDDATE"]; $Payment = $value["PAYMENT_AMOUNT"]; $Deposit = $value["DEPOSIT"]; $ProcessingFee = $value['PROCESSING_FEE']; $Terminate = $value['CLP_TERMINATE']; $Preterminate = $value['PRETERMINATE']; $Preterminatedate = $value['PRETERMINATEDATE']; $Comments = $value['COMMENTS']; $data = $unit . '!~' . $customername . '!~' . $Startdate . '!~' . $Enddate . '!~' . $Payment . '!~' . $Deposit . '!~' . $ProcessingFee . '!~' . $Terminate . '!~' . $Preterminate . '!~' . $Preterminatedate . '!~' . $Comments; $ActiveCustomerList[$key] = $data; $i++; } $this->db->query('DROP TABLE IF EXISTS ' . $activelisttablename); $this->db->query('DROP TABLE IF EXISTS ' . $sortactivelisttablename); $Returnvalue = $this->Mdl_eilib_common_function->Func_curl($ActiveCustomerList); $subject = 'ACTIVE CUST LIST-' . date("dmY"); $MailidSplit = explode('@', $Sendmailid[0]); $Username = strtoupper($MailidSplit[0]); $mailbody = "HELLO " . $Username; $mailbody = $mailbody . '' . '<br><br>, PLEASE FIND ATTACHED THE CURRENT : ' . $FILEID[1]; $message1 = new Message(); $message1->setSender($EmailDisplayname.'<'.$UserStamp.'>'); $message1->addTo($Sendmailid[0]); $message1->addCC($Sendmailid[1]); $message1->setSubject($subject); $message1->setHtmlBody($mailbody); $message1->send(); }
public function mailpart($mailsub,$mailbody,$Displayname,$UserStamp,$Sendmailid) { try { $message1 = new Message(); $message1->setSender($Displayname . '<' . $UserStamp . '>'); $message1->addTo($Sendmailid); $message1->setSubject($mailsub); $message1->setHtmlBody($mailbody); $message1->send(); return 1; } catch(Exception $e){ return 0; } // $mail = new PHPMailer; // $mail->isSMTP(); // $mail->Host = 'smtp.gmail.com'; // $mail->SMTPAuth = true; // $mail->Username = '******'; // $mail->Password = '******'; // $mail->SMTPSecure = 'tls'; // $mail->Port = 587; // $mail->FromName = $Displayname; // $mail->addAddress('*****@*****.**'); // $mail->WordWrap = 50; // $mail->isHTML(true); // $mail->Subject = $mailsub; // $mail->Body = $mailbody; // $mail->Send(); // if (!$mail->Send()) { // return "Message could not be sent"; // } else { // return 'success'; // // } }
public function getBanktt_UpdateSave($UserStamp) { $id=$_POST['Temp_Bt_id']; $type=$_POST['Banktt_SRC_TTtype']; $date=date('Y-m-d',strtotime($_POST['Banktt_SRC_Date'])); $model=$_POST['Banktt_SRC_Modelnames'];if($model=='SELECT'){$model='';} $accname=$_POST['Banktt_SRC_Accname']; $accno=$_POST['Banktt_SRC_Accno']; $amount=$_POST['Banktt_SRC_Amount']; $unit=$_POST['Banktt_SRC_Unit'];if($unit=="SELECT"){$unit="";} $customername=$_POST['Banktt_SRC_Customername'];if($customername=="SELECT"){$customername="";} $customerid=$_POST['temp_customerid']; $bankttcode=$_POST['Banktt_SRC_Bankcode']; $banktt_branchcode=$_POST['Banktt_SRC_Branchcode']; $bankaddress=$this->db->escape_like_str($_POST['Banktt_SRC_BankAddress']); $swiftcode=$_POST['Banktt_SRC_Swiftcode']; $chargesto=$_POST['Banktt_SRC_Chargesto'];if($chargesto=="SELECT"){$chargesto='';} $customerref=$this->db->escape_like_str($_POST['Banktt_SRC_Customerref']); $invdetails=$this->db->escape_like_str($_POST['Banktt_SRC_Invdetails']); $createdby=$_POST['Banktt_SRC_Createdby'];if($createdby=='SELECT'){$createdby='';} $comments=$this->db->escape_like_str($_POST['Banktt_SRC_Comments']); $status=$_POST['Banktt_SRC_Status']; if($_POST['Banktt_SRC_Debitedon']!='') { $debitedon=date('Y-m-d',strtotime($_POST['Banktt_SRC_Debitedon'])); } else { $debitedon=''; } if($chargesto!='' && $createdby!=''){$configdatas=$status.','.$createdby.','.$chargesto;} else if($chargesto!=''){$configdatas=$status.','.$chargesto;} else if($createdby!=''){$configdatas=$status.','.$createdby;} else{$configdatas=$status;} $this->db->query('SET AUTOCOMMIT=0'); $this->db->query('START TRANSACTION'); $BANKTT_SRC_updatequery="CALL SP_BANK_TT_UPDATE($id,'$configdatas','$model','$date',$amount,'$accname','$accno','$bankttcode','$banktt_branchcode','$bankaddress','$swiftcode','$customerref','$invdetails','$debitedon','$comments','$UserStamp',@BANK_SUCCESSFLAG,@BANK_SAVEPOINT)"; $this->db->query($BANKTT_SRC_updatequery); $outparm_query = 'SELECT @BANK_SUCCESSFLAG AS MESSAGE'; $outparm_result = $this->db->query($outparm_query); $Confirm_mrssage=$outparm_result->row()->MESSAGE; $outparm_query_savepoint = 'SELECT @BANK_SAVEPOINT AS SAVEPOINT'; $outparm_result_savepoint = $this->db->query($outparm_query_savepoint); $banktt_savepoint_update=$outparm_result_savepoint->row()->SAVEPOINT; $this->load->model('EILIB/Mdl_eilib_common_function'); $Sendmailid=$this->Mdl_eilib_common_function->getProfileEmailId('BANKTT'); $Displayname=$this->Mdl_eilib_common_function->Get_MailDisplayName('BANK_TT'); $username=explode('@',$Sendmailid[0]); $mailusername=strtoupper($username[0]); $headerarray=['DATE','TRANSACTION TYPE','MODEL NAME','ACC NAME','ACC NO','AMOUNT','UNIT','CUSTOMER','STATUS','DEBITED/REJECTED DATE','BANK CODE','BRANCH CODE','BANK ADDRESS','SWIFT CODE','CHARGES TO','CUST REF','INV DETAILS','DONE BY','COMMENTS']; $dataarray=[$_POST['Banktt_SRC_Date'],$type,$model,$accname,$accno,$amount,$unit,$customername,$status,$debitedon,$bankttcode,$banktt_branchcode,$_POST['Banktt_SRC_BankAddress'],$swiftcode,$chargesto,$_POST['Banktt_SRC_Customerref'],$_POST['Banktt_SRC_Invdetails'],$createdby,$_POST['Banktt_SRC_Comments']]; $subject="HELLO".','."<font color='gray'></font><font color='#498af3'><b>".$mailusername."</b> </font><br>PLEASE FIND ATTACHED NEW TRANSACTION DETAILS FROM BANK TT: <br>"; $message = '<body><br><h> '.$subject.'</h><br></body>'; for($i=0;$i<count($dataarray);$i++) { $value=$dataarray[$i]; if($customername!=null){$customername=str_replace('_',' ',$customername);} if($value=="" || $value=="SELECT" || $value==null)continue; if($value!='REJECTED') { $message.= '<body><table border="1"width="600" ><tr align="left" ><td width=40%>'.$headerarray[$i].'</td><td width=60%>'.$value.'</td></tr></table></body>'; } else { $message.= '<body><table border="1"width="600" ><tr align="left" ><td width=40%>'.$headerarray[$i].'</td><td width=60%><span style="background-color:#FF0000">'.$value.'</span></td></tr></table></body>'; } } if($status!='REJECTED') { $emailsubject="BANK TRANSFER"; } else { $emailsubject="BANK TRANSFER-REJECTED"; } $returnvalues=array($Confirm_mrssage,$emailsubject,$message,$Displayname,$Sendmailid); if($returnvalues[0]==1) { try{ $message1 = new Message(); $message1->setSender($returnvalues[3].'<'.$UserStamp.'>'); $message1->addTo($returnvalues[4][0]); $message1->addCc($returnvalues[4][1]); $message1->setSubject($returnvalues[1]); $message1->setHtmlBody($returnvalues[2]); $message1->send(); $this->db->trans_savepoint_release($banktt_savepoint_update) ;} catch(Exception $e){ $this->db->trans_savepoint_rollback($banktt_savepoint_update); return array("RECORD NOT UPDATED",$emailsubject,$message,$Displayname,$Sendmailid); } }else{ $this->db->trans_savepoint_rollback($banktt_savepoint_update); return array("RECORD NOT UPDATED",$emailsubject,$message,$Displayname,$Sendmailid); } return $returnvalues; }
<?php use google\appengine\api\mail\Message; $title = "Contact"; $msgAlert = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_POST["email"] && $_POST["subject"] && $_POST["content"]) { $msg = new Message(); $msg->setSender("*****@*****.**"); $msg->addTo("*****@*****.**"); $msg->setSubject("[nakhonratchasima-nkr] " . $_POST["subject"]); $msg->setTextBody($_POST["email"] . "\n\n" . $_POST["content"]); $msg->send(); $msgAlert = <<<END <div class="alert alert-success"> Your email has been sent. </div> END; } else { $msgAlert = <<<END <div class="alert alert-warning"> All fields are required. </div> END; } } $content = <<<END <div class="container"> <div class="row" > <div class="col-lg-12"> <center><h1 class="page-header">ติดต่อเรา</h1></center>
public function DDE_Dep_Exctsubmit($shturl,$selectedunit,$customername,$checkarray,$selectedsheet,$customermail,$customeridname,$UserStamp){ $test=array(); $submit_array=array();$submitarray=array(); $sub_exequery ="SELECT ETD .ETD_EMAIL_SUBJECT,ETD. ETD_EMAIL_BODY FROM EMAIL_TEMPLATE_DETAILS ETD ,EMAIL_TEMPLATE ET WHERE (ET .ET_ID=ETD .ET_ID) AND ET_EMAIL_SCRIPT='DEPOSIT DEDUCTION'"; $sub_rs = $this->db->query($sub_exequery); $subject_db=$sub_rs->row()->ETD_EMAIL_SUBJECT; $message_db=$sub_rs->row()->ETD_EMAIL_BODY; $rcontent = $customername." - ".$selectedunit; $subject =str_replace('[UNIT_NO - CUSTOMER_NAME]',$rcontent,$subject_db); $body =str_replace('[UNIT_NO- CUSTOMER_NAME]',$rcontent,$message_db); $emailindex = strstr($customermail,'@',true); $eusername = strtoupper($emailindex); $body = str_replace('[MAILID_USERNAME]',$eusername,$body); $this->load->model('EILIB/Mdl_eilib_common_function'); $EmailDisplayname=$this->Mdl_eilib_common_function->Get_MailDisplayName('DEPOSIT_DEDUCTION'); $pdfheader=$selectedunit.'-'.$customername; for($k=0;$k<count($checkarray);$k++){ $data5=array('DDE_flag'=>6,'shturl'=>$shturl,'selectedunit'=>$selectedunit,'customername'=>$customername,'checkarray'=>$checkarray[$k], 'selectedsheet'=>$selectedsheet,'customeridname'=>$customeridname); $submit_array=$this->Mdl_eilib_common_function->Func_curl($data5); $submitarray[]=json_decode($submit_array,true); } try { $message = new Message(); $message->setSender($EmailDisplayname.'<'.$UserStamp.'>'); $message->addTo($customermail); $message->setSubject($subject); $message->setTextBody($body); for ($i = 0; $i < count($submitarray); $i++) { $test[]=$i+1; $data = implode(array_map("chr", $submitarray[$i][0])); $message->addAttachment($pdfheader . '.pdf', $data); } $message->send(); $data5=array('DDE_flag'=>7); $response=$this->Mdl_eilib_common_function->Func_curl($data5); return $submitarray; } catch (InvalidArgumentException $e) { return $e->getMessage(); } }
$requestedApprovedBy = $_POST["approvedBy"]; $requestedOn = $_POST["requestedOn"]; $requestorEmail = $_POST["requestorEmail"]; $messageToSend = $_POST["sai"]; $reqUniq = substr($committee, 0, 3) . "-" . $reqUniq; $messageWithoutLink = $messageToSend; $messageToSend = '<pre>' . $messageToSend . '</pre>'; $messageToSendWithlink = '<pre>' . $messageWithoutLink . '</pre>' . '<a href="http://maharudramapproval2015.appspot.com/index.php?reqno=' . $todayID . '&reqby=' . $requestedBy . '&reqapprover=' . $requestedApprovedBy . '&reqemailer=' . $requestorEmail . '">Click to Approve Request!!</a>'; // message lines should not exceed 70 characters (PHP rule), so wrap it // send mail $messagePrefix = 'Facility request from ' . $committee . ' -Requested by ' . $requestedBy . '-To be Approved by ' . $requestedApprovedBy . ' - on' . $requestedOn . ' -Req Generated at:[' . $todayID . ']-Req Id:' . $reqUniq; $WithdisclaimerNoLink = $messagePrefix . '<br/><br/><pre>' . $messageToSend . '</pre><br/><br/><br/><br/>This is a Auto Generated Message Kindly Do Not reply'; $WithdisclaimerLink = $messagePrefix . '<br/><br/><pre>' . $messageToSendWithlink . '</pre><br/><br/><br/><br/>This is a Auto Generated Message Kindly Do Not reply'; try { $message = new Message(); $message->setSender("*****@*****.**"); $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); if (!empty($requestorEmail)) { $message->addTo($requestorEmail); } $message->setSubject("You Raised a Facility request from {$committee} -To be Approved by {$requestedApprovedBy} - on {$requestedOn} -Req Generated at:[{$todayID}]-Req Id:{$reqUniq}"); $message->setHtmlBody($WithdisclaimerNoLink); $message->send(); $message->setSender("*****@*****.**"); $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); if ($requestedApprovedBy == "K.Gopalakrishnan") { $message->addTo("*****@*****.**"); }
public function ERM_Update_Record($displayname,$Emailtemplate,$Rowid,$Name,$Rent,$Movedate,$Minstay,$Occupation,$Nation,$Guests,$Custage,$Contactno,$Emailid,$Comment,$UserStamp,$timeZoneFormat,$username) { $Min_stay=$this->db->escape_like_str($Minstay); $Guest=$this->db->escape_like_str($Guests); $age=$this->db->escape_like_str($Custage); $Comments=$this->db->escape_like_str($Comment); $Movedate=date('Y-m-d',strtotime($Movedate)); $this->db->query('SET AUTOCOMMIT=0'); $this->db->query('START TRANSACTION'); $CallQuery="CALL SP_ERM_UPDATE('$Occupation',$Rowid,'$Name','$Rent','$Movedate','$Min_stay','$Nation','$Guest','$age','$Contactno','$Emailid','$Comments','$UserStamp',@ERM_SUCCESSFLAG,@ERM_UPDATE_SAVE_POINT)"; $this->db->query($CallQuery); $ERM_Entry_flag = 'SELECT @ERM_SUCCESSFLAG as FLAG_INSERT'; $query = $this->db->query($ERM_Entry_flag); $Confirm_Meessage=$query->row()->FLAG_INSERT; $query_updateSavepoint= $this->db->query('SELECT @ERM_UPDATE_SAVE_POINT as ERM_UPDATE_SAVEPOINT'); $erm_update_savepoint=$query_updateSavepoint->row()->ERM_UPDATE_SAVEPOINT; $Timestamp; if($Confirm_Meessage==1) { $SelectQuery="SELECT DATE_FORMAT(CONVERT_TZ(ERM_TIMESTAMP,$timeZoneFormat),'%d-%m-%Y %T') AS ERM_TIME_STAMP FROM ERM_ENTRY_DETAILS WHERE ERM_ID=".$Rowid; $query = $this->db->query($SelectQuery); $Timestamp=$query->row()->ERM_TIME_STAMP; } $Movedate=date('d-m-Y',strtotime($Movedate)); $dataarray=array($Name,$Rent,$Movedate,$Minstay,$Occupation,$Nation,$Guests,$Custage,$Contactno,$Emailid,$Comment); $head_array=array('CUSTOMER NAME','RENT','MOVING DATE','MIN STAY','OCCUPATION','NATIONALITY','NO OF GUESTS','AGE','CONTACT','EMAIL','COMMENTS'); $subject="HELLO "."<font color='gray'></font><font color='#498af3'><b>$username</b> </font><br>PLEASE FIND ATTACHED NEW LEED DETAILS FROM ERM: <br>"; $message = '<body><br><h> '.$subject.'</h><br</body>'; if($Confirm_Meessage==1) { for($i=0;$i<count($head_array);$i++) { $value=$dataarray[$i]; if($value=="" || $value==null)continue; $message .= '<body><table border="1"width="500" ><tr align="left" ><td width=40%>'.$head_array[$i].'</td><td width=60%>'.$value.'</td></tr></table></body>'; } } $Return_values=array($Confirm_Meessage,$Timestamp,$UserStamp,$message); $message=$Return_values[3]; $mydate=getdate(date("U")); $month=strtoupper($mydate[month]); $sysdate="$mydate[mday]-$month-$mydate[year]"; $emailsubject="NEW ERM LEED -[".$sysdate."]"; if($Return_values[0]==1) { try{ $message1 = new Message(); $message1->setSender($displayname.'<'.$UserStamp.'>'); $message1->addTo($Emailtemplate[0]); $message1->addCc($Emailtemplate[1]); $message1->setSubject($emailsubject); $message1->setHtmlBody($message); $message1->send(); $this->db->trans_savepoint_release($erm_update_savepoint) ; } catch(Exception $e){ $this->db->trans_savepoint_rollback($erm_update_savepoint); return array("RECORD NOT UPDATED",$Timestamp,$UserStamp,$message); } }else{ $this->db->trans_savepoint_rollback($erm_update_savepoint); return array("RECORD NOT UPDATED",$Timestamp,$UserStamp,$message); } return $Return_values; }
public function Remindermailpart($mailsub,$mailbody,$EmailDisplayname,$UserStamp,$Mailid) { $message1 = new Message(); $message1->setSender($EmailDisplayname.'<'.$UserStamp.'>'); $message1->addTo($Mailid); $message1->setSubject($mailsub); $message1->setHtmlBody($mailbody); $message1->send(); }