-1
我想一個PHP腳本中,發送端和接收端均在PHP核心獲取電子郵件.... 請給我例子或完整的腳本的網頁鏈接...發件人和reciever都得到在PHP腳本郵件
我想一個PHP腳本中,發送端和接收端均在PHP核心獲取電子郵件.... 請給我例子或完整的腳本的網頁鏈接...發件人和reciever都得到在PHP腳本郵件
<?php
class MailerDaemon {
/**
* Set $isHTML to true in case the content to be send is in HTML
* if no CC is required, set $cc to be NULL
*/
public function sendMail($toEmail, $toName, $subject, $content, $isHTML, $cc) {
try {
$config = array(
'ssl' => 'tls',
'port' => '587',
'auth' => 'login',
'username' => '<Replace with your Mail Sender Username>',
'password' => '<Replace with your Mail Sender Password>',
);
$transport = new Zend_Mail_Transport_Smtp("<Replace with your SMTP Hostname>", $config);
Zend_Mail::setDefaultTransport($transport);
$mail = new Zend_Mail();
if ($isHTML) {
$mail->setBodyHtml($content);
} else {
$mail->setBodyText($content);
}
$mail->setFrom("<Replace with your Mail Sender Username/Email ID>", "<Replace with your Mail Sender Full Name>");
$mail->addTo($toEmail, $toName);
if($cc==NULL){$mail->addCc($cc);}
$mail->setSubject($subject);
$mail->send($transport);
} catch (Exception $exc) {
echo $exc->getTraceAsString();
return false;
}
return true;
}
}
?>
我對你確實需要什麼感到有點困惑,但是看到你把這個問題標記爲Joomla相關,我沒有看到下載Zend的重點。
我認爲一個簡單的聯繫表格擴展就足夠了。
http://extensions.joomla.org/extensions/contacts-and-feedback/contact-forms
我的答案只針對他的問題。在Joomla的情況下,我覺得我很無奈 – 2012-08-14 18:59:19