I think you are not configured properly,
if you are using XAMPP then you can easily send mail from localhost.
for example you can configure C:xamppphpphp.ini
and c:xamppsendmailsendmail.ini
for gmail to send mail.
in C:xamppphpphp.ini
find extension=php_openssl.dll
and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.
in php.ini file find [mail function]
and change
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = [email protected]
sendmail_path = "C:xamppsendmailsendmail.exe -t"
(use the above send mail path only and it will work)
Now Open C:xamppsendmailsendmail.ini
. Replace all the existing code in sendmail.ini with following code
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=my-gmail-password
[email protected]
Now you have done!! create php file with mail function and send mail from localhost.
Update
First, make sure you PHP installation has SSL support (look for an "openssl" section in the output from phpinfo()
).
You can set the following settings in your PHP.ini:
ini_set("SMTP","ssl://smtp.gmail.com");
ini_set("smtp_port","465");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…