previousMail_Mime::get() (Previous) (Next) Mail_Mime::setHTMLBody()next

View this page in Last updated: Sun, 21 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Mail_Mime::headers()

Mail_Mime::headers() – ヘッダ行を構築する

Synopsis

require_once 'Mail/mime.php';

array &headers ( array $headerEx = = null , boolean $overwrite = = false )

Description

電子メールの先頭に必要なヘッダ (MIME-Version と Content-Type) の配列を返します。 headers() を呼ぶ前に、関数get() を呼ばなければならないことに注意してください。

Parameter

  • array $headerEx - 追加のヘッダで、引き数の書式は $array["header-name"] = "header-value" です。

  • boolean $overwrite - 既存のヘッダを上書きするかどうか。 FALSE の場合は既存の値をそのまま保持します。

Return value

array - MIME ヘッダおよび追加のヘッダの連想配列。 返り値は直接Mail::send() の第 2 パラメータに渡すことが出来ます。

Note

This function can not be called statically.

Mail_Mime::get()後にMail_Mime::headers()を呼ぶ必要があります。

previousMail_Mime::get() (Previous) (Next) Mail_Mime::setHTMLBody()next

Download Documentation Last updated: Sun, 21 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
Note by: NWdev
It appears Mail_mime adds the \r\n to the individual headers via the _encodeHeaders function (mime.php in version 1.5.2) -- so you can avoid spinning your wheels by not adding them again to your header values:

This:
<code>
$headers['Subject'] = "Your Order Information";
</code>

Not this:
<code>
$headers['Subject'] = "Your Order Information\r\n";
</code>
Note by: dcasper@pressaprint.com
I ran into this so others may as well. When attempting to assign a custom Content-Type header to your messages you need to remember to call the function as

$mime->headers($hdrs, true);

In order to get your custom header to get used. There's a default Content-Type header of text/plain that only gets replaced if you pass along the $overwrite boolean as true.
Note by: Stephen Dewey
Note that although this page omits it, you should still add the To field explicitly using this function.