94hwan-PHP框架基本原理

Source:94hwan 与众不同  Author:网络部
2010-07-13 15:13

考虑通用性原因,目前已经停止单独使用此类,也不建议在项目里单独使用邮件发送类,而是使用用户中心的API通过统一的邮件队列进行发送。

户中心的API文件是:pub_user_api.php

其中发邮件的方法为:

  1. /** 
  2.     * 发送邮件 
  3.     * @parem $to            目标邮箱 
  4.     * @parem $subject       邮件标题 
  5.     * @parem $body          邮件内容 
  6.     * @parem $app           应用标识(这涉及发件人帐号) 
  7.     * @parem $level         紧急程度(1为立即,其它为队列) 
  8.     * @parem $failed_resend 失败后是否重发 0|1 
  9.     * @return string     'true' 成功 'false' 失败 
  10.     */ 
  11.     public function send_mail( $to$subject$body$app=''$level=1, $failed_resend=0  ) 
  12.     { 
  13.         $rs = $this->_call_api_method('sendMail'array('to'=>$to'subject'=>$subject'body'=>$body'app'=>'915'
  14.                                       'level'=>$level'failed_resend'=>$failed_resend), 'post' ); 
  15.         return $rs
  16.     } 

使用方法:

$pua = new pub_user_api('', '', false);

$pua->send_mail( $to, $subject, $body, 'wo');

其中 app ID 可以向相关管理人员索取。

...