我想要一个php脚本,其中发送者和接收者都在核心php中获取电子邮件.... 请给我一些示例或完整脚本的网页链接......
答案 0 :(得分:1)
<?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;
}
}
?>
答案 1 :(得分:1)
我对你所需要的内容感到有些困惑,但是看到你将这个问题标记为Joomla相关的内容,我没有看到下载Zend的重点。
我认为简单的联系表单扩展就足够了。
http://extensions.joomla.org/extensions/contacts-and-feedback/contact-forms