示例#1
0
 function qd_send_mail($type, $to = null, $subject = null, $content = null, $other_header = array(), $attach = null, $debug = 0)
 {
     $type_org = $type;
     $mail =& Qdmail::getInstance();
     $mail->debug = $debug;
     if (!is_array($type)) {
         $type = array('TYPE' => $type);
     }
     list($type, $link) = $mail->keyUpper($type);
     $option = array();
     $return = array();
     $type = array_change_key_case($type, CASE_UPPER);
     $option = isset($type['OPTION']) && is_array($type['OPTION']) ? $type['OPTION'] : array();
     $return = isset($type['RETURN']) && is_array($type['RETURN']) ? $type['RETURN'] : array();
     if (isset($type['SMTP'])) {
         $option = array_merge($option, array('SMTP' => true, 'smtpServer' => $type['SMTP']));
     }
     $type = isset($type['TYPE']) ? $type['TYPE'] : 'text';
     $_type = array('TEXT' => 'Text', 'HTML' => 'Html', 'DECO' => 'Deco', 'DECOTEMPLATE' => 'DecoTemplate');
     $easy_method = isset($_type[strtoupper($type)]) ? 'easy' . $_type[strtoupper($type)] : '_';
     if (!method_exists($mail, $easy_method)) {
         $mail->errorGather('Illegal type \'' . $type . '\'', __LINE__);
         return false;
     }
     $ret = $mail->{$easy_method}($to, $subject, $content, $other_header, $attach, $option);
     foreach ($return as $method => $value) {
         if (method_exists($mail, $method)) {
             $type_org[$link['RETURN']][$method] = $mail->{$method}($value);
         }
     }
     if (0 !== count($return)) {
         $type_org[$link['RETURN']]['qd_send_mail'] = $ret;
         $ret = $type_org;
     }
     return $ret;
 }