Php 配合 Shell 发送邮件
PHPMailer_v5.1.tar.gz
http://sourceforge.net/projects/phpmailer/
send.php
http://sourceforge.net/projects/phpmailer/
send.php
#!/bin/php
<?php
require("PHPMailer_v5.1/class.phpmailer.php");
system("/home/ygcn/new/can/php/rs.sh"); //配置Shell 脚本
$mail = new PHPMailer();
$address = "收件人";
$mail->IsSMTP();
$mail->Host = "SNMP 服务器";
$mail->SMTPAuth = true;
$mail->Username = "发件人";
$mail->Password = "发件人密码";
$mail->From = "发件人";
$mail->FromName = "";
$mail->AddAddress("$address", "");
$sdate = date("Y-m-d H:i", time());
$ssub = "$sdate 主题";
$body = file_get_contents("/home/index.html"); //要发送的 内容 (支持Html)
$mail->IsHTML(true);
$mail->CharSet = "UTF-8";
$mail->Subject = "$ssub";
$mail->Body = "$body";
$mail->Send();
?>
<?php
require("PHPMailer_v5.1/class.phpmailer.php");
system("/home/ygcn/new/can/php/rs.sh"); //配置Shell 脚本
$mail = new PHPMailer();
$address = "收件人";
$mail->IsSMTP();
$mail->Host = "SNMP 服务器";
$mail->SMTPAuth = true;
$mail->Username = "发件人";
$mail->Password = "发件人密码";
$mail->From = "发件人";
$mail->FromName = "";
$mail->AddAddress("$address", "");
$sdate = date("Y-m-d H:i", time());
$ssub = "$sdate 主题";
$body = file_get_contents("/home/index.html"); //要发送的 内容 (支持Html)
$mail->IsHTML(true);
$mail->CharSet = "UTF-8";
$mail->Subject = "$ssub";
$mail->Body = "$body";
$mail->Send();
?>