PHPsu
MANUAL ZH  |  EN
     


Current Position :| index>FAQ> Sending HTML email with PHP

Sending HTML email with PHP

FROM: AUTHOR: TIME:2008-04-20 HITS:
Code:
<?php
require("class.phpmailer.php");
require("class.smtp.php");

class MyMailer extends PHPMailer {
public $From = "form-results@google";
public $FromName = "Google.com";
public $Host = "mail.google";
public $Hostname = "google";

phpsu


public $Mailer = "smtp";
public $Sender = "form-results@google";
public $SMTPAuth = true;
public $Username = "form-results@google";
public $Password = "youwish";
}


$emailresults = '<html><head><title></title></head><body>
<div style="position:relative; margin:40px 0; padding:1px;">'.$myformss.$debugger.$mess.'</div></body></html>';

session_start();

if(!isset($_SESSION['mailsent'])) $_SESSION['mailsent']=0;
else $_SESSION['mailsent']++;


if ($_SESSION["mailsent"] < 10) {
$_SESSION["mailsent"]++;
$mail = new MyMailer();
$mail->IsHTML(true);
$mail->AddAddress("post-to-blog@google");
$mail->AddBCC("webmaster@google");
$mail->Subject = $mysubject;
$mail->Body = $emailresults;

phpsu提供的php教程


$mail->AltBody = "You are viewing this message because your email client is not configured for html emails.$mess";
$mail->SetLanguage('en');
if(!$mail->Send())
{
$mail->ClearAllRecipients();
echo "Message was not sent<br>";
echo "Mailer Error: " . $mail->ErrorInfo;
} else $mail->ClearAllRecipients();

} else die('MAILSENT OVER LIMIT!');

?> http://www.phpsu.com

  
Reply With Quote

TITLE:Sending HTML email with PHP
Copyright 2008 The PHPsu All rights reserved. This mirror generously provided by: .Hp Inc.
Last updated: Fri Jun 6 22:56:39 GMT-8 2008