Home > PHP > cấu hình gửi mail cho xampp window (localhost)

cấu hình gửi mail cho xampp window (localhost)

Step 1: Mở file xampp\php\php.ini

tìm dòng [mail function] // line 1099
thay đổi các tham số như sau:


; For Win32 only.
; http://php.net/smtp
SMTP = stmp.gmail.com
; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = your_mail@gmail.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"

Step 2: Mở file xampp\sendmail\sendmail.ini

Thêm tham số:


# A freemail service example
account Gmail
tls on
tls_certcheck off
host smtp.gmail.com
from your_mail@gmail.com
auth on
user your_mail@gmail.com
password your_pass_word
port 587

Thay đổi tham số:


# Set a default account
account default : Gmail

Sau đó restart lại xampp & chạy code PHP gửi email OK.

Lưu ý: Code PHP bạn nên kết hợp với cấu hình SMTP

PHP Developer
nhantam

thiết kế web

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: