- 论坛徽章:
- 0
|
本帖最后由 moshangxie 于 2011-09-19 16:27 编辑
回复 5# xinglu1983
确实些shell习惯了,对PHP也不熟悉
以日期为变量的文件名确实写不出来
汗[code]
$mail->FromName = "test";
$mail->AddAddress("test@126.com", "test");
$date= date("Ymd");
echo $date;
$mail->WordWrap = 50;
$mail->AddAttachment("/opt/sendmail/log/ldap_modify-$date.rar"); 添加附件 绝对路径+日期变量的文件名
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "modify-$date is OK!!!";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?> |
|