web-dev-qa-db-ja.com

localhost WAMPサーバーからメールを送信して、Gmail Hotmailなどのメールを送信する方法

localhost WAMPからメールを送信するの方法に関する適切な情報を見つけています。また、特定の承認メールアドレスからのメール送信を承認する方法は、他のメールアドレスを送信します。

このステップ全体を設定する方法で詳細を説明します。すでにここでいくつかのスタックオーバーフローの回答とブログの投稿にアクセスしていますが、すべて非常に混乱し、古いため、動作しない可能性があります。だから私はStack Overflowユーザーの助けが必要です。ありがとうございました。

21
Jay Patel

localhostから動作する電子メールクライアントを設定するのは非常に面倒です。最後に、メールを送信するこの方法を見つけました(WAMP、XAMPPなどを使用):

インストール hMailServer

このhMailServer設定を構成します。

  1. HMailServer Administratorを開きます。
  2. [ドメインを追加...]ボタンをクリックして、新しいドメインを作成します。
  3. ドメインテキストフィールドの下に、コンピューターのローカルホストIPを入力します。
    • 例:127.0.0.1はローカルホストIPです。
  4. [保存]ボタンをクリックします。
  5. 次に、[設定]> [プロトコル]> [SMTP]に移動し、[メールの配信]タブを選択します。
  6. Localhostフィールドを検索して、「localhost」と入力します。
  7. [保存]ボタンをクリックします。

Gmailアカウントを設定し、次の変更を実行します。

  1. [設定]> [プロトコル]> [SMTP]に移動し、[メールの配信]タブを選択します。
  2. [リモートホスト名]フィールドに「smtp.gmail.com」と入力します。
  3. ポート番号として「465」を入力します。
  4. 「サーバーには認証が必要」をチェックします。
  5. [ユーザー名]フィールドにGoogle Mailアドレスを入力します。
  6. パスワードフィールドにGoogle Mailのパスワードを入力します。
  7. チェックマーク「SSLを使用」
  8. すべての変更を保存します。

オプショナル

別のコンピューターからメールを送信する場合は、次の手順で外部アカウントから外部アカウントへの配信を許可する必要があります。

  1. [設定]> [詳細]> [IP範囲]に移動し、IPアドレスが127.0.0.1である[マイコンピュータ]をダブルクリックします。
  2. [外部から外部アカウントへの配信を許可する]チェックボックスをオンにします。
  3. [保存]ボタンを使用して設定を保存します。
18
Jay Patel

私にとって Fake Sendmail は動作します。

対処方法:

1)C:\wamp\sendmail\sendmail.ini:を編集します

smtp_server=smtp.gmail.com
smtp_port=465
[email protected]
auth_password=your_password

2)php.iniを編集し、sendmail_pathを設定します

sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"

それでおしまい。これで、メールをテストできます。

9
Anand Singh

偽のsendmailを使用して、WAMP環境でメールを送信してみてください。

http://jesin.tk/using-sendmail-on-windows/

3
tchow002
a) Open the "php.ini". For XAMPP,it is located in C:\XAMPP\php\php.ini. Find out if you are using WAMP or LAMP server. Note : Make a backup of php.ini file 

b) Search [mail function] in the php.ini file. 

You can find like below.
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25


; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost


Change the localhost to the smtp server name of your ISP. No need to change the smtp_port. Leave it as 25. Change sendmail_from from postmaster@localhost to your domain email address which will be used as from address.. 

So for me, it will become like this.
[mail function]
; For Win32 only.
SMTP = smtp.planetghost.com
smtp_port = 25
; For Win32 only.
sendmail_from = [email protected]
auth_username = [email protected]
auth_password = example_password


c) Restart the XAMPP or WAMP(Apache server) so that changes will start working.

d) Now try to send the mail using the mail() function , 

mail("[email protected]","Success","Great, Localhost Mail works");

クレジット

================================================== ==============================

別の方法

GmailサーバーはSSLでSMTP認証を使用します。そのような状況ではmail()関数を使用する方法はないと思うので、これらの選択肢を確認することをお勧めします。

  1. PEAR:メール
  2. phpMailer

どちらもSSLでのSMTP認証をサポートしています。

クレジット: 参照の回答をここで確認してください

2
Mitul Shah

電子メールを送信しない沼の設定がある場合、行うべきことがいくつかあります。 1. ispのsmtpサーバー名を確認します。 Gmailのことは、おそらく不必要な複雑さです。2.「www」フォルダーにphpsetup.phpファイルを作成し、次のように編集します。

<?php
   phpinfo();
?>

これにより、Wampが使用しているものを把握できます。 3. php.iniファイルを検索します。サーバーがあるかもしれません。必要なのは、上記のファイルの出力に影響するものです。 4.最も可能性の高いphp.iniでsmtpアドレスを見つけます。 5.ブラウザにlocalhost/phpsetup.phpと入力し、smtp設定までスクロールします。 「localhost」と表示されるはずです。6. php.iniファイルのsmtp設定を、ISPのsmtpサーバーの名前に編集します。 phpsetup.phpが変更されているかどうかを確認してください。それがうまくいったなら、間違ったファイルを動かしていないなら。

この問題は、Wordpressサイトにありますが、彼らはあまりにも彼ら自身であるか、クライアントを取得しようとしています。;)

0
Hotwire

Sendmailを使用して、Wampサーバーによってローカルホストから電子メールを送信する手順を次に示します。

  1. まず、Sendmail Zipファイルをダウンロードする必要があります link
  2. Zipファイルを抽出し、C:\ wampに配置します
  3. ここで、C:\wamp\sendmail\sendmail.iniSendmail.iniを編集する必要があります
smtp_server=smtp.gmail.com 
smtp_port=465
[email protected]
auth_password=your_password
  1. メールアカウントにアクセスします。歯車ツール> [設定]> [転送とPOP/IMAP]> [IMAPアクセス]をクリックします。 [IMAPを有効にする]をクリックして、変更を保存します
  2. WAMPサーバーを実行します。 Apacheモジュールでssl_moduleを有効にします。
  3. 次に、PHPでphp_opensslとphp_socketsを有効にします。
  4. **ここで重要な部分を開きますphp.iniファイルの"C:\wamp\bin\php\php5.5.12\php.ini"および"C:\wamp\bin\Apache\apache2.4.9\bin\php.ini" setsendmail_path**

sendmail_path = "C:\ wamp\sendmail\sendmail.exe -t"

  1. Wamp Serverを再起動します。

それは確実に機能します。

0
Khaled Rahman

PHPmailerライブラリを使用して電子メールを送信するための最良の方法は次のとおりです。これが私にとって有効な唯一の方法です。

require_once 'mailer/class.phpmailer.php';
    $mail = new PHPMailer(); // create a new object
    $mail->IsSMTP(); // enable SMTP
    $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
    $mail->SMTPAuth = true; // authentication enabled
    $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 465; // or 587
    $mail->IsHTML(true);
    $mail->Username = "[email protected]";
    $mail->Password = "xxxxxxx";
    $mail->SetFrom("[email protected]");
    $mail->AddAddress($to);
    $logfile = dirname(dirname(__FILE__)) . '/mail.log';
    try {
        $mail->Body = $message;
        $mail->Subject = $subject;


        file_put_contents($logfile, "Content: \n", FILE_APPEND);
        file_put_contents($logfile, $message . "\n\n", FILE_APPEND);

        if(!$mail->Send()) {
            echo "Mailer Error: " . $mail->ErrorInfo;
        } else {
            echo "Email has been sent";
        }
    } catch (Exception $e) {
        #print_r($e->getMessage());
        file_put_contents($logfile, "Error: \n", FILE_APPEND);
        file_put_contents($logfile, $e->getMessage() . "\n", FILE_APPEND);
        file_put_contents($logfile, $e->getTraceAsString() . "\n\n", FILE_APPEND);
    }
0
Umair

メールを送信するSMTPサーバーがない場合、メールの送信にこのコードを使用します。

click below for mail sending code

ここをクリック

最初にこれを行うことができますGmailアカウントの安全性が低い Gmailアカウントでメールを送信した後

このphp.ini設定を使用できます

;smtp = smtp.gmail.com
;smtp-port = 25
;sendmail_from = my gmail is here

およびsendmail.ini設定

smtp_server = smtp.gmail.com
smtp_port = 465
smtp_ssl = auto
auth_username = my gmail is here
auth_password = password
hostname = localhost

you can try this changes and i hope this code sent mail....
0
Avdhesh