我在我的域名上創建了一個網頁,我希望允許任何訪問者通過電子郵件將此頁面發送給任何人。如何通過電子郵件發送網頁?
該頁面有圖片,css和php代碼。它從我的網站獲得5大新聞。
我想使用這個類:
<?php
include_once("../DataAccess.php");
class sendmail
{
/**
* @var from mail.
*/
public $from = "[email protected]";
/**
* @var from name.
*/
public $fromName = " Mail List";
/**
* @var to mail.
*/
public $to = '[email protected]'; // 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 [email protected]';
/**
* @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 = "[email protected]";
$send_mail->fromName = "Zamalkawy Ana";
$send_mail->to = "[email protected]";
$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.';
?>
...但是當我把它,我只得到的新聞標題和圖片,並不能看到頁面的模板。
我該怎麼做?
只要你知道,如果你從一個地址,如雅虎發送郵件,而實際上它並不來自雅虎服務器,它可能會被丟棄(谷歌DKIM和發件人策略框架以獲取更多信息) –
目的使用谷歌的電子郵件,但不發送臨時電子郵件 –