-1

我想要一个 php 脚本,其中发送者和接收者都在核心 php 中收到电子邮件......请给我示例或完整脚本的 Web 链接......

4

2 回答 2

1

I'm a little confused as to exactly what you need, however seeing as you have tagged this question as Joomla related, I don't see the point in download Zend.

I think a simple contact form extensions will suffice.

http://extensions.joomla.org/extensions/contacts-and-feedback/contact-forms

于 2012-08-14T13:11:40.530 回答
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. 下载并提取 Zend 库 http://www.zend.com/en/community/downloads
  2. 将“Zend”文件夹复制到您的工作目录,该目录可以在解压缩的文件夹中找到(希望在库目录下)。
  3. 将以下代码粘贴到 PHP 文件中并按照指示进行必要的更改。
于 2012-08-14T12:22:31.043 回答