PageRenderTime 28ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/php/function.imap-mail-compose.html

https://bitbucket.org/thncr/manuals
HTML | 104 lines | 86 code | 18 blank | 0 comment | 0 complexity | 8074bffd76c2bb0bed825cd67e83a817 MD5 | raw file
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Create a MIME message based on given envelope and body sections</title>
  6. </head>
  7. <body><div class="manualnavbar" style="text-align: center;">
  8. <div class="prev" style="text-align: left; float: left;"><a href="function.imap-lsub.html">imap_lsub</a></div>
  9. <div class="next" style="text-align: right; float: right;"><a href="function.imap-mail-copy.html">imap_mail_copy</a></div>
  10. <div class="up"><a href="ref.imap.html">IMAP 函数</a></div>
  11. <div class="home"><a href="index.html">PHP Manual</a></div>
  12. </div><hr /><div id="function.imap-mail-compose" class="refentry">
  13. <div class="refnamediv">
  14. <h1 class="refname">imap_mail_compose</h1>
  15. <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">imap_mail_compose</span> &mdash; <span class="dc-title">Create a MIME message based on given envelope and body sections</span></p>
  16. </div>
  17. <div class="refsect1 description" id="refsect1-function.imap-mail-compose-description">
  18. <h3 class="title">说明</h3>
  19. <div class="methodsynopsis dc-description">
  20. <span class="type">string</span> <span class="methodname"><strong>imap_mail_compose</strong></span>
  21. ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$envelope</code></span>
  22. , <span class="methodparam"><span class="type">array</span> <code class="parameter">$body</code></span>
  23. )</div>
  24. <p class="para rdfs-comment">
  25. Create a MIME message based on the given <em><code class="parameter">envelope</code></em>
  26. and <em><code class="parameter">body</code></em> sections.
  27. </p>
  28. </div>
  29. <div class="refsect1 parameters" id="refsect1-function.imap-mail-compose-parameters">
  30. <h3 class="title">参数</h3>
  31. <p class="para">
  32. <dl>
  33. <dt>
  34. <span class="term"><em><code class="parameter">envelope</code></em></span>
  35. <dd>
  36. <p class="para">
  37. An associative array of headers fields. Valid keys are: &quot;remail&quot;,
  38. &quot;return_path&quot;, &quot;date&quot;, &quot;from&quot;, &quot;reply_to&quot;, &quot;in_reply_to&quot;, &quot;subject&quot;,
  39. &quot;to&quot;, &quot;cc&quot;, &quot;bcc&quot;, &quot;message_id&quot; and &quot;custom_headers&quot; (which contains
  40. associative array of other headers).
  41. </p>
  42. </dd>
  43. </dt>
  44. <dt>
  45. <span class="term"><em><code class="parameter">body</code></em></span>
  46. <dd>
  47. <p class="para">
  48. An indexed array of bodies
  49. </p>
  50. <p class="para">
  51. A body is an associative array which can consist of the following keys:
  52. &quot;type&quot;, &quot;encoding&quot;, &quot;charset&quot;, &quot;type.parameters&quot;, &quot;subtype&quot;, &quot;id&quot;,
  53. &quot;description&quot;, &quot;disposition.type&quot;, &quot;disposition&quot;, &quot;contents.data&quot;,
  54. &quot;lines&quot;, &quot;bytes&quot; and &quot;md5&quot;.
  55. </p>
  56. </dd>
  57. </dt>
  58. </dl>
  59. </p>
  60. </div>
  61. <div class="refsect1 returnvalues" id="refsect1-function.imap-mail-compose-returnvalues">
  62. <h3 class="title">返回值</h3>
  63. <p class="para">
  64. Returns the MIME message.
  65. </p>
  66. </div>
  67. <div class="refsect1 examples" id="refsect1-function.imap-mail-compose-examples">
  68. <h3 class="title">范例</h3>
  69. <p class="para">
  70. <div class="example" id="example-3165">
  71. <p><strong>Example #1 <span class="function"><strong>imap_mail_compose()</strong></span> example</strong></p>
  72. <div class="example-contents">
  73. <div class="phpcode"><code><span style="color: #000000">
  74. <span style="color: #0000BB">&lt;?php<br /><br />$envelope</span><span style="color: #007700">[</span><span style="color: #DD0000">"from"</span><span style="color: #007700">]=&nbsp;</span><span style="color: #DD0000">"joe@example.com"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$envelope</span><span style="color: #007700">[</span><span style="color: #DD0000">"to"</span><span style="color: #007700">]&nbsp;&nbsp;=&nbsp;</span><span style="color: #DD0000">"foo@example.com"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$envelope</span><span style="color: #007700">[</span><span style="color: #DD0000">"cc"</span><span style="color: #007700">]&nbsp;&nbsp;=&nbsp;</span><span style="color: #DD0000">"bar@example.com"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$part1</span><span style="color: #007700">[</span><span style="color: #DD0000">"type"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">TYPEMULTIPART</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$part1</span><span style="color: #007700">[</span><span style="color: #DD0000">"subtype"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">"mixed"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$filename&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"/tmp/imap.c.gz"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"r"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$contents&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fread</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">filesize</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$part2</span><span style="color: #007700">[</span><span style="color: #DD0000">"type"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">TYPEAPPLICATION</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$part2</span><span style="color: #007700">[</span><span style="color: #DD0000">"encoding"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">ENCBINARY</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$part2</span><span style="color: #007700">[</span><span style="color: #DD0000">"subtype"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">"octet-stream"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$part2</span><span style="color: #007700">[</span><span style="color: #DD0000">"description"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">basename</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$part2</span><span style="color: #007700">[</span><span style="color: #DD0000">"contents.data"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">$contents</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$part3</span><span style="color: #007700">[</span><span style="color: #DD0000">"type"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">TYPETEXT</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$part3</span><span style="color: #007700">[</span><span style="color: #DD0000">"subtype"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">"plain"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$part3</span><span style="color: #007700">[</span><span style="color: #DD0000">"description"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">"description3"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$part3</span><span style="color: #007700">[</span><span style="color: #DD0000">"contents.data"</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">"contents.data3\n\n\n\t"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$body</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">$part1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$body</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">$part2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$body</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">$part3</span><span style="color: #007700">;<br /><br />echo&nbsp;</span><span style="color: #0000BB">nl2br</span><span style="color: #007700">(</span><span style="color: #0000BB">imap_mail_compose</span><span style="color: #007700">(</span><span style="color: #0000BB">$envelope</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$body</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span>
  75. </span>
  76. </code></div>
  77. </div>
  78. </div>
  79. </p>
  80. </div>
  81. </div><hr /><div class="manualnavbar" style="text-align: center;">
  82. <div class="prev" style="text-align: left; float: left;"><a href="function.imap-lsub.html">imap_lsub</a></div>
  83. <div class="next" style="text-align: right; float: right;"><a href="function.imap-mail-copy.html">imap_mail_copy</a></div>
  84. <div class="up"><a href="ref.imap.html">IMAP 函数</a></div>
  85. <div class="home"><a href="index.html">PHP Manual</a></div>
  86. </div></body></html>