今回の質問なんですが、お問い合わせフォームからPOSTされた時にサーバーから自分にメールを送りたいのですが
うまくいきません
サーバーは,
こんな感じです centOS6.7 Apache php7 postfix2.6.6
試した事
サーバーからコマンドラインでメールは送信できました
PHPも下記のコードで送信できました。
php -r echo "test" | /usr/sbin/sendmail -t -i アドレス@docomo.ne.jp
ただホームページからは全然遅れません。(HPのコード)
mb_language("Japanese");
mb_internal_encoding("UTF-8");
$to = 'アドレス@docomo.ne.jp';
$subject = 'タイトル';
$message = '本文';
$headers = 'From:info@サイトのアドレス' . "\r\n";
$ck = mb_send_mail($to, $subject, $message, $headers);
if ($ck) {
echo "ok";
} else {
echo "no";
}
質問内容が解りにくいと思いますが、
よろしくお願いいたします。
php.iniの内容を追記します
[mail function]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail -t -i
SMTP=localhost
smtp_port=25
; 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().
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On
; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog
回答2件
あなたの回答
tips
プレビュー