| Server IP : 27.254.152.13 / Your IP : 216.73.217.38 Web Server : Apache/2 System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64 User : coloflew ( 1072) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/coloflew/domains/tessabalpatiu.go.th/private_html/lib/class/ |
Upload File : |
<?php
############################################################
// SYSTEM MAIL
############################################################
function clean_input_4email($value, $check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/to:/';
$patterns[2] = '/cc:/';
$patterns[3] = '/bcc:/';
if ($check_all_patterns)
{
$patterns[4] = '/\r/';
$patterns[5] = '/\n/';
$patterns[6] = '/%0a/';
$patterns[7] = '/%0d/';
}
//NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
return preg_replace($patterns, "", strtolower($value));
}
############################################################
function sendEmail($subject,$nameFrom,$mailfrom, $msg, $mailto, $mailcc, $mailbcc, $mailreply) {
require_once('PHPmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSendmail(); // telling the class to use SendMail transport
$body = eregi_replace("[\]",'',$msg);
$mail->SetFrom($mailfrom, $nameFrom);
$mail->AddReplyTo($mailreply,"");
$mail->AddAddress($mailto, "");
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
if(!$mail->Send()) {
return false;
} else {
return true;
}
/*$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
//echo $mailto; // 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
//$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "ssl://smtp.gmail.com:465"; // sets the SMTP server
//$mail->Port = "465"; // set the SMTP port for the GMAIL server
$mail->Username = "webmaster@humanracing.co.th"; // SMTP account username
$mail->Password = "0894565552"; // SMTP account password
//$mail->SetFrom($mailfrom,$mailfrom);
$mail->SetFrom('list@mydomain.com', 'List manager');
$mail->AddCC($mailcc, $name = '');
$mail->AddBCC($mailreply, $name = '');
$mail->AddReplyTo($mailbcc,"");
$address = $mailto;
$mail->AddAddress($address, "");
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
//echo "==>".$body;
//exit;//$mail->AddAttachment("PHPmailer/images/phpmailer.gif"); // attachment
//$mail->AddAttachment("PHPmailer/images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
//echo "Mailer Error: ". $mail->ErrorInfo;
return false;
} else {
// echo "Message sent!";
return true;
}*/
}//sendEmail
function formEmail($urllink="", $msg) {
$res="<table align='center' border='0' cellspacing='0' cellpadding='0' width='100%' style='border:1px solid #ccc;'>";
$res.="<tr>";
$res.="<td align='left' style='padding:20px; padding-left:20px; width:700px;'>";
$res.= $msg;
$res.="</td>";
$res.="<td></td>";
$res.="</tr>";
$res.="</table>";
$res.="<span style='font-size: 14pt;font-weight: none;text-align:right;'> --<br> <img src='".URL."images/logo.png' style='background:#212121'><br>";
$res.=" " .@date("F j, Y"). "</span><p>";
return $res;
}//formEmail
function emailContact($subject,$email,$to,$arrDetail){
//echo "<pre>"; print_r($arrDetail);
$mailto = $to;
$mailcc = "";
$mailbcc= "";
$mailfrom= $arrDetail['email'];
$message = "" ;
$message .= "<table><tr>" ;
$message .= "<td>Name: </td><td>".$arrDetail['contactname']."</td>";
$message .= "</tr><tr>" ;
$message .= "<td><strong>Email</strong> : </td><td><a href='mailto:".$arrDetail['email']."'>".$arrDetail['email']."</a></td>";
$message .= "</tr><tr>" ;
$message .= "<td><strong>Country</strong> : </td><td>".$arrDetail['country']."</td>";
$message .= "</tr><tr>" ;
$message .= "</tr><tr>" ;
$message .= "<td><strong>Postal Address</strong> : </td><td>".$arrDetail['address']."</td>";
$message .= "</tr><tr>" ;
$message .= "</tr><tr>" ;
$message .= "<td><strong>Phone number</strong> : </td><td>".$arrDetail['mobile']."</td>";
$message .= "</tr><tr>" ;
$message .= "<td><strong>Comment</strong> : </td><td>"".$arrDetail['detail'].""</td>";
$message .= "</tr></table>";
$msg=formEmail($subject, $message);
//echo $msg;
//exit;
$ret=sendEmail($subject,$arrDetail['contactname'], $mailfrom, $msg, $mailto, $mailcc, $mailbcc, $mailreply);
return $ret;
}
?>