我想用phpmailer發送郵件。從php項目發送電子郵件與phpmailer?
這樣做,我搜索谷歌,我發現了一擊鏈接:
http://phpmailer.worxware.com/
,所以我從這裏下載自己的音樂庫(通過下載鏈接在他們的網站上,PHP 4-5):
http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php4/0.90/
後,我參考本示例:(意味着使用SMTP高級)
http://phpmailer.worxware.com/index.php?pg=exampleasmtp
<?php
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
$mail->Host = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "mail.yourdomain.com"; // sets the SMTP server
$mail->Port = 26; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // SMTP account username
$mail->Password = "yourpassword"; // SMTP account password
$mail->AddReplyTo('[email protected]', 'First Last');
$mail->AddAddress('[email protected]', 'John Doe');
$mail->SetFrom('[email protected]', 'First Last');
$mail->AddReplyTo('[email protected]', 'First Last');
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML(file_get_contents('contents.html'));
$mail->AddAttachment('images/phpmailer.gif'); // attachment
$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
$mail->Send();
echo "Message Sent OK\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
,但我找不到class.phpmailer.php文件中查找該行 - > require_once( '../ class.phpmailer.php');來自dowloaded文件。
我錯過了什麼嗎?
你會幫我呢?
此致敬意。
謝謝4回答/我明白你的意思/但沒有class.phpmailer.php文件/ PLZ下載該項目,看看我說什麼! /我應該從另一個位置下載它嗎? – LostLord 2011-02-01 23:10:41