- 论坛徽章:
- 0
|
哪位能给出一个例子,谢谢!!
我只在网上找了php的,没有找shell的,我把php贴出来,请大家看一下,
<?php
// multiple recipients
$to = 'aaa@163.com' . ', '; // note the comma
$to .= 'aaa@163.com';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
//经过测试了的,可以发html邮件,不过事先要在配置文件里配好smtp
<?
$to="someone@sina.com";//a mail address
$subject="test mail";
$body="<table width='100%' border='1' cellspacing='0' cellpadding='0'>
<tr>
<td>11</td>
<td>12</td>
</tr>
<tr>
<td>21</td>
<td>22</td>
</tr>
</table>";
echo $subject;
echo $from;
$send=mail($to,$subject,stripslashes($body),"From: ".$from."\r\nContent-Type: text/html;charset=\"gb2312\"");
if($send)
echo "send";
else
echo "not send";
?>
因为上面的to= aaa@163.com的邮箱地址,要从一个文件里读取,其中还有主题,内容,所以很想用shell实现。 |
|