PHPEye开源社区 » Zend Framework 使用讨论 » zend_mail 的简单用法
《Programming PHP》第二版上市
2008-4-21 12:47 keenlio
zend_mail 的简单用法

和大家分享zend_mail的用法:
function sendWelcome($user, $email, $pass){

      require_once 'Zend/Mail.php';
      Zend_Loader :: loadClass('Common');
      $mail = new Zend_Mail();

      $mail->setFrom('noreply@company.com', "noreply");
      $mail->setSubject('We welcome you!');
      $mail->setBodyText($user.",\n\n
             Welcome! You've just registered at company
             with the following information:\n\n
             Username: ".$user."\n
             Password: ".$pass."\n\n
             If you ever lose or forget your password, a new
             password will be generated for you and sent to this
             email address, if you would like to change your
             email address you can do so by going to the
             My Account page after signing in.\n\n
             - name");

      $mail->addTo($email, $user);
      $mail->send();

      $msgArr[] = "Add new user mail sent!";
      Common :: showMessage($msgArr);
   }

2008-4-22 03:04 布老虎
真够简单的,不错。

页: [1]
查看完整版本: zend_mail 的简单用法


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.