我在我的域上创建了一个网页,我希望允许任何访问者通过电子邮件将此页面发送给任何人。
页面有图片、css和php代码。它从我的网站获得前 5 条新闻。
我正在尝试使用这个类:
<?php
include_once("../DataAccess.php");
class sendmail
{
/**
* @var from mail.
*/
public $from = "kam@yahoo.com";
/**
* @var from name.
*/
public $fromName = " Mail List";
/**
* @var to mail.
*/
public $to = 'eng.k@gmail.com'; // note the comma , if you want multiple recipients
/**
* @var to name.
*/
public $name = 'Khaled';
/**
* @var subject.
*/
public $subject = 'Hello World !!';
/**
* @var message.
*/
public $message = 'Thank you, your message has been received We will reply you as soon eng@gmail.com';
/**
* @var newlines.
*/
private $RN = "\r\n";
/**
* @var message charset.
*/
public $charset = 'utf-8';
/**
* Sends an email.
*
* @author Yousef Ismaeil.
*/
public function mail_to ()
{
$mail = &$this;
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0'.$mail->RN;
$headers .= 'Content-type: text/html; charset='.$mail->charset.''.$mail->RN;
// Additional headers
$headers .= 'To: '.$mail->name.' <'.$mail->to.'>'.$mail->RN;
$headers .= 'From: '.$mail->fromName.' <'.$mail->from.'>'.$mail->RN;
$headers .= 'Return-Path: '.$mail->from.'\r\n';
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
if (@mail($mail->to, $mail->subject, $mail->message, $headers))
{
return true;
}
else
{
return false;
}
}
}
$date1=date('Y-m-d');
$send_mail = new sendmail();
$send_mail->from = "zizo@yahoo.com";
$send_mail->fromName = "Zamalkawy Ana";
$send_mail->to = "kam@ar.com";
$send_mail->name = "Khlaed";
$send_mail->subject = "Zamalkawy Ana Sports news for ".$date1;
$homepage = file_get_contents('http://zamalkawyana.com/MailList/home.php');
$send_mail->message = $homepage;
if ($send_mail->mail_to()) echo 'Msg sent';
else echo 'Can\'t send msg.';
?>
...但是当我发送它时,我只得到新闻的标题和图片,而看不到页面的模板。
我怎样才能做到这一点?