php写的发送附件的程序(二)
y."\r\n".$this->build_part($i); } $this->mime = $this->multipart."--".$boundary."--\r\n"; } /*************************************** ** Sends the mail. ***************************************/ function send($to_name, $to_addr, $from_name, $from_addr, $subject = '''', $headers = ''''){ if($to_name != '''') $to = ''"''.$to_name.''" <''.$to_addr.''>''; else $to = $to_addr; if($from_name != '''') $from = ''"''.$from_name.''" <''.$from_addr.''>''; else $from = $from_addr; $this->headers.= ''From: ''.$from."\r\n"; //$this->headers.= $headers; mail($to, $subject, $this->mime, $this->headers); } /*************************************** ** Use this method to deliver using direct ** smtp connection. Relies upon Manuel Lemos'' ** smtp mail delivery class available at: ** http://phpclasses.upperdesign.com ** ** void smtp_send( string *Name* of smtp object, ** string From address, ** array To addresses, ** array Headers, ** string The body) ***************************************/ function smtp_send($smtp_obj, $from_addr, $to_addr){ global $smtp_obj; $smtp_obj = $smtp_obj; if(substr($this->headers, -2) == "\r\n") $this->headers = substr($this->headers,0,-2); $this->headers = explode("\r\n", $this->headers); $smtp_obj->sendmessage($from_addr, $to_addr, $this->headers, $this->mime); } } // End of class. ?> |
查看所有评论
