xaampのMercurを使ってphpで外部のサーバへメールを送信

xaampのMercurを使ってphpで外部のサーバへメールを送信

xaamp環境でphpでメールを外部に送信できるように設定。
smtpサーバはnifty。
smtpで認証が必要な設定。

●php.iniの設定

私の場合はC:xamppphpphp.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
;smtp_port = 25
smtp_port = 587
;25をコメントアウトして587を追加

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost
sendmail_from = xyz0123@nifty.com
;送信元アドレスを追加

●Mercury/32の設定

XAMPP Control Panel Application
MercuryのAdminボタンをクリックするとソフト画面が起動
メニューバー >
Configuration >
Protocol modules > MercuryC SMTP relaying clientをチェックTP relaying client
Mercury SMTP Server > Generalタブ >GeneralのAlternate portに「587」
Connection controlタブのRelaying controlのDo not permit SMTP relaying of non-local mailのチェックを外す。
すべてのチェックが外れた状態になると思われる。
Mercury SMTP Relay Client Configuration >
SMTP”Smart” Host details >
Smart host name:smtp.nifty.com
Connection port/type:587

Credentials for SMTP Authentication,if required
Login username:xyz0123
Password:xxxxxxx

●メール送信phpファイル

<form action=”” method=”post”>
<input type=”submit” name=”Send” value=”送信”>
</form>
<?php

// 現在の言語を日本語に設定
mb_language(“ja”);
// 内部文字コードをUTF-8に設定
mb_internal_encoding(“UTF-8”);

if(isset($_POST[‘Register’])){
//宛先、題名、本文、送信メールアドレスの順
     $re = mb_send_mail(“xxxxxxx@gmail.com”,”test”,”test”,”From:xyz0123@nifty.com”);
     if ($re) {
     print “送信完了!”;
     } else {
     print “送信失敗。”;
     }
}
?>

More posts

  • ドーパミン

    ドーパミン

    ドーパミンについてのメモやる気を上げる 快楽物質と報酬系 人は罰で動くのか報酬で動くのか アクセス数: 23 続きを読む

  • IQメモ

    IQメモ

    IQのメモIQを上げる方法など 目次 「1日10分」でスピード脳に生まれ変わる 苫米地英人 (著) 抽象度が上… 続きを読む

  • 米の高騰

    米の高騰

    米の高騰に関してのメモ 竹中平蔵 武田邦彦は農林中金が運用を失敗したのを穴埋めするため。 アクセス数: 5 続きを読む

  • pH、ペーハー

    pH、ペーハー

    pH、ペーハーとは pHは水素イオンの量を表す数字酸性 水素イオンが多いアルカリ性 水素イオンが少ない1〜14… 続きを読む

  • 消費税

    消費税

    消費税についてのメモ 消費税の実質は売上税である。 アメリカの売上税売上税を支払うのは最終消費者のみである。 … 続きを読む

  • インボイス

    インボイス

    インボイスについてのメモ 目次 インボイス前 卸から店 10000*1.10 = 11,000卸が消費税100… 続きを読む