Vic
|
發表於 2006-4-19 11:45 AM |
呵呵~ 我沒細看, 原來要 PEAR Mail package
不過4.0以後, 很可能已經安裝了, 也就是不用去下載再自行安裝.
另外, tar其實是可以用winrar等解壓縮程式來開的. 
其實我知道有PHPMailer這東西, 不過我以為是功課...源碼必須用最基本的方法. 呵呵
最後送上3支花, 感謝你分享自己學習的經驗....這是件非常好的事. 
| |
cheng822
|
發表於 2006-4-19 11:15 AM |
終於成功的發出E-Mail~
感謝VIC大的幫助
我在這邊也做個總結
VIC大提供的SMTP驗證我沒辦法使用因為它是用TAR的壓縮檔
我是找另一個程式叫PHPMailer
D/L後把class.phpmailer.php跟class.smtp.php Copy到跟你要做Mail的PHP檔同一個資料夾下
例:wwwroot/class.phpmailer.php
wwwroot/class.smtp.php
wwwroot/id.php
id.php中的CODE是
<?php
require("class.phpmailer.php"); //把class.phpmailer.php加進去
$mail = new PHPMailer(); //新Mail@_@?
$mail->IsSMTP(); // 不知道@_@
$mail->Host = "smtp.xxxxxx.com"; //設SMTP的server
$mail->SMTPAuth = true; // SMTP authentication打開
$mail->Username = "username"; // SMTP authentication的username
$mail->Password = "password"; // SMTP authentication的password
$mail->From = "name@xxx.com"; //Mail是從哪寄的
$mail->FromName = "Mailer"; //Mail是誰寄的
$mail->AddAddress("name2@xxx.com","Name"); //要寄去的email address
$mail->AddAddress("name3@xxx.com"); //如要寄給第2個人可用這行
$mail->AddReplyTo("name@xxx.com","Information"); //按reply後會用這個email Address
$mail->WordWrap = 50; // set word wrap<-不懂...
$mail->AddAttachment("/var/tmp/file.tar.gz"); //夾檔(我不用所以//掉)
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); //夾帶圖片(我不用所以//掉)
$mail->IsHTML(true); //用HTML方式顯示
$mail->Subject = "Title"; //標題
$mail->Body = "This is the <b>HTML body</b>"; //信件內容
$mail->AltBody = "This is the text-only body"; //<-不知@_@
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
| |
Vic
|
發表於 2006-4-18 07:40 PM |
|
cheng822
|
發表於 2006-4-18 04:01 PM |
感謝熊大的回覆~
我用PHPbb也架了一個討論站看它的php code怎麼寫...(完全看不懂..)
在PHPbb時有設SMTP的address...然後用smtp.php, emailer.php, usercp_sendpasswd送出email(自己猜的....錯了別打我).也成功的送出忘記密碼的E-Mail.
只是現在有一個問題...我朋友的Project是架在Web Hosting的...應該是用Windows Server(猜的)...如果要像論壇一樣讓使用者可以用自己的Email回寄Password要如何做?
(讓使用者輸入EMail->Match mysql data base->找到ID and password->用mail()加上id and password送出)<-請問這樣對嗎?
如果要用php內定的mail() funtion要設SMTP address嗎?
再次的感謝您的回覆~
| |
Vic
|
發表於 2006-4-18 11:04 AM |
|
cheng822
|
發表於 2006-4-17 02:30 PM |
大家好, 我是幫我朋友問的. 她最近在做一個Project, 可以讓使用者輸入申請時的E-Mail然後PHP會自動寄User name and Password給使用者.
我本身不會PHP所以請大大是否可以把原使碼或PHP file貼上來. 不方便的話也可以題供意見就好.
麻煩各位了...感激不盡.
| |