Gmail の SMTP サーバを使う場合を示す。
1. C:\pleiades\xampp\php\php.ini を編集する。
SMTP、smtp_port、sendmail_path(mailtodisk.exeを向いているもの)をコメントにし、 sendmail_path (sendmail.exe を向いているもの)を有効にする。
1. C:\pleiades\xampp\php\php.ini を編集する。
SMTP、smtp_port、sendmail_path(mailtodisk.exeを向いているもの)をコメントにし、 sendmail_path (sendmail.exe を向いているもの)を有効にする。
[mail function] sendmail_path = "\"C:\pleiades\xampp\sendmail\sendmail.exe\" -t" mail.add_x_header = Off mail.log = "C:\pleiades\xampp\php\logs\php_mail.log"2. C:\pleiades\xampp\sendmail\sendmail.ini を編集する。
[sendmail] smtp_server=smtp.gmail.com smtp_port=587 smtp_ssl=auto default_domain=gmail.com error_logfile=error.log auth_username=自分のGmailアドレス auth_password=自分のGmailパスワード pop3_server= pop3_username= pop3_password= force_sender=自分のGmailアドレス force_recipient= hostname=テスト用のページ。
<?php if (mail("to@example2.com", "TEST MAIL", "This is a test message.", "From: from@example.com")) { echo "メールが送信されました。"; } else { echo "メールの送信に失敗しました。"; } ?>