| 1行目: | 1行目: | ||
== 概要 == | == 概要 == | ||
<code>mail</code>関数または<code>mb_send_mail</code>関数を使用して、メールを送信する手順を記載する。<br> | <code>mail</code>関数または<code>mb_send_mail</code>関数を使用して、メールを送信する手順を記載する。<br> | ||
<br><br> | |||
== php.iniの設定 == | |||
<code>mail</code>関数または<code>mb_send_mail</code>関数では、php.iniファイルで設定したSMTPサーバ名とポート番号の値を読み込んで使用する。<br> | |||
そのため、php.iniファイルの該当箇所を適切な値に設定する必要がある。<br> | |||
<br> | |||
php.iniファイルの[mail function]において、以下の設定を記述する。<br> | |||
* SMTP | |||
*: SMTPサーバのホスト名またはIPアドレスを指定する。 | |||
*: もし、ローカル環境のメール送信用サーバを使用する場合、<code>localhost</code>でもよい。 | |||
* smtp_port | |||
*: メールの送信時に使用するポート番号を指定する。 | |||
*: 標準のポート番号は<code>25</code>番であるが、迷惑メール対策で<code>Outbound Port25 Blocking</code>が実施されている場合は、<code>587</code>番等を使用する。 | |||
*: 使用するメールサーバに合わせて設定すること。 | |||
* sendmail_from | |||
*: Windowsで使用する場合、<code>sendmail_from</code>にメール送信元のメールアドレスを設定できる。 | |||
*: 設定する場合は、先頭のセミコロン(;)を外してメールアドレスを設定する。 | |||
[mail function] | |||
; For Windows only. | |||
SMTP = <SMTPサーバのホスト名またはIPアドレス> | |||
smtp_port = <ポート番号> | |||
; For Windows only. | |||
;sendmail_from = me@example.com | |||
; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). | |||
;sendmail_path = | |||
; Force the addition of the specified parameters to be passed as extra parameters | |||
; to the sendmail binary. These parameters will always replace the value of | |||
; the 5th parameter to mail(), even in safe mode. | |||
;mail.force_extra_parameters = | |||
<br> | |||
以下に、設定例を示す。<br> | |||
[mail function] | |||
; For Win32 only. | |||
SMTP = smtp.example.jp | |||
smtp_port = 25 | |||
; For Win32 only. | |||
sendmail_from = peke@example.jp | |||
<br> | |||
設定変更後は、Apache等のWebサーバを再起動する。<br> | |||
<br><br> | <br><br> | ||