首页 Soft PlugIn RAN乱 Dev开发 Info资料 English WAP 留言 登陆 注册
-
Posted by Yippee | 评论(0) | 引用(0) | 阅读2433次
LINUX PHP EMAIL 附件 MIME

LINUX PHP EMAIL 附件

http://www.phpe.net/?n=Classes&p=2&t=12
Mimemessage    简介:   一个功能相对强大的邮件类
http://www.phpe.net/class/30.shtml
用来对邮件进行编码并发送,它的特性:
- 使用者可定义的头部和主题的分开。
- 多用途互联网邮件扩充 ,分别定义了encoding 和 HTML 两种模式。
- 自动的内容类型识别,自动识别附件。
- 支持为 multipart/ 相关信息 (eg。 有植入的图像, stylesheets 的 HTML 信息等..)
- 支持为 multipart/ 替代方案信息.
- 错误递送住址直接的设定回返- 路径首领召集 sendmail 计画的定义。
- 一些子为送不同的方法信息分类: PHP 邮件 () 功能, sendmail , qmail, SMTP.( 由于支持为证明而且指示递送模态)
#!/usr/bin/php -q
<?php
 require("./mail.php");
 $from_address=getenv("USER")." at " dot getenv("HOSTNAME");
 $from_name=getenv("USERNAME");
 $reply_name=$from_name;
 $reply_address=$from_address;
 $reply_address=$from_address;
 $error_delivery_name=$from_name;
 $error_delivery_address=$from_address;
 $to_name="shengfang";
 $to_address="www.shengfang.org";

 $subject="国画风格和test mimeemail";
 $email_message=new email_message_class;
 $email_message->SetEncodedEmailHeader("To",$to_address,$to_name);
 $email_message->SetEncodedEmailHeader("From",$from_address,$from_name);
 $email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name);
 $email_message->SetHeader("Sender",$from_address);

/*
 *  Set the Return-Path header to define the envelope sender address to which bounced messages are delivered.
 *  If you are using Windows, you need to use the smtp_message_class to set the return-path address.
 */
 if(defined("PHP_OS")
 && strcmp(substr(PHP_OS,0,3),"WIN"))
  $email_message->SetHeader("Return-Path",$error_delivery_address);

 $email_message->SetEncodedHeader("Subject",$subject);

/*
 *  A message with attached files usually has a text message part
 *  followed by one or more attached file parts.
 */
 $text_message="Hello大都很高发挥更好 ";
 $email_message->AddQuotedPrintableTextPart($email_message->WrapText($text_message));
 $image_attachment=array(
  "FileName"=>"./mail.php",
  "Content-Type"=>"automatic/name"
 );

 $text_attachment=array(
  "Data"=>"说得好啥地方动感大放光华容光焕发",
  "Name"=>"attachment.txt",
  "Content-Type"=>"automatic/name"
 );
 $email_message->AddFilePart($text_attachment);

 $email_message->AddFilePart($image_attachment);
 $error=$email_message->Send();
 if(strcmp($error,""))
  echo "Error: $error\n";
 else
  echo "Message sent to $to_name\n";
 mail ("www.shengfang.org", "Subjecttttt", "Hellottt!");

?>


字体:

Permanant URI永久地址 http://www.shengfang.org/blog/p/linuxphpemailath2.php
Trackback URI引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1133046063

2005年11月27日07:01星期日  [Dev开发] 追踪此文的RSS
提示:
此文还没有评论。

称呼:    登陆   注册
   不注册,但记住我的信息
邮件:
(非必须)
评论: [UBB代码帮助]
粗体 斜体 下划线 链接 水平线 引用



验证码: 请输入你看见的数字
关闭UBB      提交时自动将内容复制到剪贴板

公告
Fire and Motion!

统计信息
[Yippee]||[统计]||日志:1790
在线: 15||用户: 2562 [列表]
今日:1944||到访:2671443
Rss:838380||评论:1584

最新日志

最新评论

友情链接

日历

最新引用

搜索

归档

杂项
Get RSS Feed (Version 2.0)
Get Atom Feed (Version 0.3)
编码:  UTF-8