<?php
include('SMTPClass.php');
$use_smtp = '0';
$emailto = '[email protected]';
// retrieve from parameters
$emailfrom = isset($_POST["email"]) ? $_POST["email"] : "";
$nocomment = isset($_POST["nocomment"]) ? $_POST["nocomment"] : "";
$subject = 'Email from Caprice';
$message = '';
$response = '';
$response_fail = 'There was an error verifying your details.';
// Honeypot captcha
if($nocomment == '') {
$params = $_POST;
foreach ( $params as $key=>$value ){
if(!($key == 'ip' || $key == 'emailsubject' || $key == 'url' || $key == 'emailto' || $key == 'nocomment' || $key == 'v_error' || $key == 'v_email')){
$key = ucwords(str_replace("-", " ", $key));
if ( gettype( $value ) == "array" ){
$message .= "$key: \n";
foreach ( $value as $two_dim_value )
$message .= "...$two_dim_value<br>";
}else {
$message .= $value != '' ? "$key: $value\n" : '';
}
}
}
$response = sendEmail($subject, $message, $emailto, $emailfrom);
} else {
$response = $response_fail;
}
echo $response;
// Run server-side validation
function sendEmail($subject, $content, $emailto, $emailfrom) {
$from = $emailfrom;
$response_sent = 'Thank you. Your comments have been received.';
$response_error = 'Error. Please try again.';
$subject = filter($subject);
$url = "Origin Page: ".$_SERVER['HTTP_REFERER'];
$ip = "IP Address: ".$_SERVER["REMOTE_ADDR"];
$message = $content."\n$ip\r\n$url";
// Validate return email & inform admin
$emailto = filter($emailto);
// Setup final message
$body = wordwrap($message);
if($use_smtp == '1'){
$SmtpServer = 'SMTP SERVER';
$SmtpPort = 'SMTP PORT';
$SmtpUser = 'SMTP USER';
$SmtpPass = 'SMTP PASSWORD';
$to = $emailto;
$SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body);
$SMTPChat = $SMTPMail->SendMail();
$response = $SMTPChat ? $response_sent : $response_error;
} else {
// Create header
$headers = "From: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: quoted-printable\r\n";
// Send email
$mail_sent = @mail($emailto, $subject, $body, $headers);
$response = $mail_sent ? $response_sent : $response_error;
}
return $response;
}
// Remove any un-safe values to prevent email injection
function filter($value) {
$pattern = array("/\n/", "/\r/", "/content-type:/i", "/to:/i", "/from:/i", "/cc:/i");
$value = preg_replace($pattern, "", $value);
return $value;
}
exit;
?>
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
553web_HTML手机电脑网站_网页源码移动端前端js效果_H5模板_自适应css源码ui组件.zip (226个子文件)
style.css 27KB
prettyPhoto.css 27KB
ie9.css 648B
ie7.css 236B
ie8.css 109B
loader.gif 6KB
loader.gif 2KB
loader.gif 2KB
loader.gif 2KB
loader.gif 2KB
loader.gif 2KB
loader.gif 2KB
default_thumbnail.gif 227B
default_thumbnail.gif 227B
default_thumbnail.gif 227B
default_thumbnail.gif 227B
default_thumbnail.gif 227B
blog2.html 15KB
portfolio.html 14KB
portfolio4.html 13KB
service-icons.html 13KB
tabs-toggle-table.html 13KB
portfolio2.html 12KB
index2.html 12KB
post2.html 12KB
portfolio3.html 12KB
blog.html 11KB
index.html 11KB
index3.html 10KB
buttons-boxes-images.html 10KB
portfolio-post.html 9KB
typography.html 9KB
contact.html 8KB
post.html 8KB
testimonials.html 8KB
form.html 3KB
preview.jpg 183KB
1.jpg 92KB
p1-full.jpg 34KB
slide1.jpg 29KB
slide2.jpg 29KB
slide3.jpg 28KB
slide4.jpg 28KB
blog2-4.jpg 15KB
blog2-1.jpg 14KB
blog2-3.jpg 14KB
blog2-2.jpg 14KB
p4-4.jpg 13KB
p4-8.jpg 13KB
p4-5.jpg 13KB
p4-1.jpg 13KB
p4-7.jpg 13KB
p4-3.jpg 13KB
p4-6.jpg 13KB
p4-2.jpg 13KB
p3-4.jpg 11KB
p3-8.jpg 11KB
p3-5.jpg 11KB
p3-9.jpg 11KB
p3-1.jpg 11KB
p3-3.jpg 11KB
p3-7.jpg 11KB
p3-6.jpg 11KB
p3-2.jpg 11KB
p3-10.jpg 11KB
dropdown.jpg 9KB
p2-10.jpg 5KB
p2-6.jpg 5KB
p2-2.jpg 5KB
p2-7.jpg 5KB
p2-3.jpg 5KB
p2-11.jpg 5KB
p2-4.jpg 5KB
p2-12.jpg 5KB
p2-8.jpg 5KB
p2-9.jpg 5KB
p2-5.jpg 5KB
p2-1.jpg 5KB
p4.jpg 3KB
p6.jpg 3KB
p10.jpg 3KB
p14.jpg 3KB
p13.jpg 3KB
p9.jpg 3KB
p5.jpg 3KB
p1.jpg 3KB
p15.jpg 3KB
p11.jpg 3KB
p7.jpg 3KB
p3.jpg 3KB
p8.jpg 3KB
p12.jpg 3KB
p16.jpg 3KB
p2.jpg 3KB
s1.jpg 2KB
s2.jpg 2KB
s3.jpg 2KB
codebg.jpg 1KB
jquery-1.6.4.min.js 90KB
jquery.prettyPhoto.js 33KB
共 226 条
- 1
- 2
- 3
资源评论
2301_76429513
- 粉丝: 9
- 资源: 6730
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功