殷德瑶博客
喜欢的歌,静静地听!喜欢的人,远远地看!

利用php发信组件实现表单提交邮件发送功能(进而实现网站钓鱼功能“盗号”)

殷德瑶 2015-9-19 emlog教程 评论 2815 次

环境必须开通 Gmail发信组件功能

<?php//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('../class.phpmailer.php');
//include("class.smtp.php"); //可选,会自动从class.phpmailer.php加载
$mail=new PHPMailer();
$body=file_get_contents('contents.html');
$body=Strtr($body,Array("\\"=""));//$body= eregi_replace("[\]",'',$body);
$mail-IsSMTP();              // 告诉程式要使用SMTP
$mail-SMTPDebug = 2;            // 开启 SMTP debug 信息 (测试时使用)// 1 = 错误和消息// 2 = 只有消息
$mail-SMTPAuth  = true;          // 开启 SMTP 验证
$mail-SMTPSecure = "ssl";          // sets the prefix to the servier
$mail-Host    = "smtp.gmail.com";    // sets GMAIL as the SMTP server
$mail-Port    = 465;          // set the SMTP port for the GMAIL server
$mail-Username  = "see7di@gmail.com";    // GMAIL用户名
$mail-Password  = "******";        // GMAIL密码
$mail-CharSet = "utf-8";    //加入该行代码可以防止信件内容乱码
 
$mail-SetFrom('see7di@gmail.com','张三');    //发信人邮件地址及用户名
//$mail-AddReplyTo("see7di@gmail.com","张三");  //回复地址及用户名
 
$subject='這是郵件標題';
$mail-Subject  = "=?UTF-8?B?".base64_encode($subject)."?= ";//使用base64编码是为了防止信件标题乱码
 
$mail-MsgHTML($body);
 
$mail-AddAddress("see7di@msn.com","李四");    //接收者邮件地址及用户名
//附件
//$mail-AddAttachment("images/phpmailer.gif");   // attachment
//$mail-AddAttachment("images/phpmailer_mini.gif"); // attachment
 
if(!$mail-Send()) {
echo "Mailer Error: ".$mail-ErrorInfo;
}else{
echo "Message sent!";
}
?>

代码可根据实际情况改变



没有标签!

发表评论


粤ICP备15078261号 Powered by 黑暗之夜
Theme by 殷德瑶博客