File: mb-send-mail.xml

package info (click to toggle)
php-doc 20140201-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 74,084 kB
  • ctags: 4,040
  • sloc: xml: 998,137; php: 20,812; cpp: 500; sh: 177; makefile: 63; awk: 28
file content (191 lines) | stat: -rw-r--r-- 6,410 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 332578 $ -->
<refentry xml:id="function.mb-send-mail" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>mb_send_mail</refname>
  <refpurpose>Send encoded mail</refpurpose>
 </refnamediv>
   
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>mb_send_mail</methodname>
   <methodparam><type>string</type><parameter>to</parameter></methodparam>
   <methodparam><type>string</type><parameter>subject</parameter></methodparam>
   <methodparam><type>string</type><parameter>message</parameter></methodparam>
   <methodparam choice="opt"><type>string</type><parameter>additional_headers</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type>string</type><parameter>additional_parameter</parameter><initializer>&null;</initializer></methodparam>
  </methodsynopsis>
  <para>
   Sends email. Headers and messages are converted and encoded according
   to the <function>mb_language</function> setting. It's a wrapper function
   for <function>mail</function>, so see also <function>mail</function> for details.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>to</parameter></term>
     <listitem>
      <para>
       The mail addresses being sent to. Multiple
       recipients may be specified by putting a comma between each
       address in <parameter>to</parameter>. 
       This parameter is not automatically encoded.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>subject</parameter></term>
     <listitem>
      <para>
       The subject of the mail.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>message</parameter></term>
     <listitem>
      <para>
       The message of the mail.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>additional_headers</parameter> (optional)</term>
     <listitem>
      <para>
       String to be inserted at the end of the email header.
      </para>
      <para>
       This is typically used to add extra headers (From, Cc, and Bcc).
       Multiple extra headers should be separated with a CRLF (\r\n).
       Validate parameter not to be injected unwanted headers by attackers.
      </para>
      <note>
       <para>
        When sending mail, the mail <emphasis>must</emphasis> contain
        a <literal>From</literal> header. This can be set with the 
        <parameter>additional_headers</parameter> parameter, or a default
        can be set in &php.ini;.
       </para>
       <para>
        Failing to do this will result in an error
        message similar to <literal>Warning: mail(): "sendmail_from" not
        set in php.ini or custom "From:" header missing</literal>.
        The <literal>From</literal> header sets also
        <literal>Return-Path</literal> under Windows.
       </para>
      </note>
      <note>
       <para>
        If messages are not received, try using a LF (\n) only.
        Some Unix mail transfer agents (most notably
        <link xlink:href="&url.qmail;">qmail</link>) replace LF by CRLF
        automatically (which leads to doubling CR if CRLF is used).
        This should be a last resort, as it does not comply with
        <link xlink:href="&url.rfc;2822">RFC 2822</link>.
       </para>
      </note>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>additional_parameter</parameter></term>
     <listitem>
      <para>
       <parameter>additional_parameter</parameter> is a MTA command line
       parameter. It is useful when setting the correct Return-Path
       header when using sendmail.
      </para>
      <para>
       This parameter is escaped by <function>escapeshellcmd</function> internally
       to prevent command execution. <function>escapeshellcmd</function> prevents
       command execution, but allows to add addtional parameters. For security reason,
       this parameter should be validated.
      </para>
      <para>
       Since <function>escapeshellcmd</function> is applied automatically, some characters
       that are allowed as email addresses by internet RFCs cannot be used. Programs
       that are required to use these characters <function>mail</function> cannot be used.
      </para>
      <para>
       The user that the webserver runs as should be added as a trusted user to the
       sendmail configuration to prevent a 'X-Warning' header from being added
       to the message when the envelope sender (-f) is set using this method.
       For sendmail users, this file is <filename>/etc/mail/trusted-users</filename>.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>5.0.0</entry>
       <entry>
        The <literal>Content-Type</literal> and <literal>Content-Transfer-Encoding</literal> 
        headers may be redefined as of PHP 5.0.0. Before this time, the values defined by
        <function>mb_language</function> are always used.
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>mail</function></member>
    <member><function>mb_encode_mimeheader</function></member>
    <member><function>mb_language</function></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->