国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php寫的發送附件的程序(一)

2024-05-04 23:02:16
字體:
來源:轉載
供稿:網友

 

heyes
  
   <?
  error_reporting(63);
  include('class.html_mime_mail.inc');
  
  /***************************************
  ** example of usage.
  ***************************************/
  /***************************************
  ** read the file background.gif into
  ** $backgrnd.
  ***************************************/
  $filename = 'background.gif';
  $backgrnd = fread($fp = fopen($filename, 'r'), filesize($filename));
  fclose($fp);
  
  /***************************************
  ** read the file test.zip into $attachment.
  ***************************************/
  $filename = 'example.zip';
  $attachment = fread($fp = fopen($filename, 'r'), filesize($filename));
  fclose($fp);
  
  /***************************************
  ** create the mail object. optional headers
  ** argument. do not put from: here, this
  ** will be added when $mail->send
  ***************************************/
  $mail = new html_mime_mail("x-mailer: html mime mail class/r/n");
  
  /***************************************
  ** if sending an html email, then these
  ** two variables specify the text and
  ** html versions of the mail. don't
  ** have to be named as these are. just
  ** make sure the names tie in to the
  ** $mail->add_html() command further down.
  ***************************************/
  $text = 'this is a test.';
  $html = '<html><body background="background.gif"><font face="verdana, arial" color="#ff0000">    success!</font><p></body></html>';
  
  /***************************************
  ** add the text, html and embedded images.
  ** each embedded image has to be added
  ** using $mail->add_html_image() before
  ** calling $mail->add_html(). the name
  ** of the image should match exactly
  ** (case-sensitive) to the name in the html.
  ***************************************/
  $mail->add_html_image($backgrnd, 'background.gif', 'image/gif');
  $mail->add_html($html, $text);
  
  /***************************************
  ** if not sending an html email, then
  ** this is used to set the plain text
  ** body of the email.
  ***************************************/
  // $mail->body = 'fsss';
  
  /***************************************
  ** this is used to add an attachment to
  ** the email.
  ***************************************/
  $mail->add_attachment($attachment, 'example.zip', 'application/octet-stream');
  
  /***************************************
  ** builds the message.
  ***************************************/
  $mail->build_message();
  
  /***************************************
  ** sends the message. $mail->build_message()
  ** is seperate to $mail->send so that the
  ** same email can be sent many times to
  ** differing recipients simply by putting
  ** $mail->send() in a loop.
  ***************************************/
  $mail->send('','[email protected]', 'from name', '[email protected]', 'subject','');
  
  /***************************************
  ** debug stuff. entirely unnecessary.
  ***************************************/
  echo '<pre>';
  echo $mail->mime;
  echo '</pre>';
  ?>
  

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 晴隆县| 阆中市| 梅河口市| 乌兰浩特市| 措美县| 胶南市| 陆河县| 巨野县| 泽普县| 日喀则市| 泸州市| 澳门| 郁南县| 靖安县| 普格县| 中山市| 鹿邑县| 卢湾区| 油尖旺区| 宜兰县| 雅安市| 木兰县| 望城县| 卢龙县| 崇义县| 台东县| 亳州市| 乌什县| 黎平县| 呈贡县| 衡东县| 柳州市| 甘孜县| 东安县| 尼木县| 永胜县| 富源县| 南汇区| 博爱县| 航空| 张掖市|