Gaz*_*Gaz 18 email xampp gmail smtp
我正在尝试通过XAMPP配置Sendmail来发送电子邮件.在我的sendmail.ini中,我有以下设置:
# Set default values for all following accounts.
logfile "C:\xampp\sendmail\sendmail.log
account Gmail
tls on
port 587
tls_certcheck off
host smtp.gmail.com
from myemail@gmail.com
auth on
user myemail06@gmail.com
password mypassword
account default : Gmail
Run Code Online (Sandbox Code Playgroud)
我已经创建了一个这样的测试脚本:
$to = "testemail@btinternet.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$headers = "From: myemail06@gmail.com" . "\r\n";
if (mail($to, $subject, $body, $headers)) {
echo ("Message successfully sent!");
} else {
echo ("Message delivery failed...");
}
Run Code Online (Sandbox Code Playgroud)
我收到一条消息,说电子邮件已发送但它永远不会到达,而且我收到的日志中:
sendmail:交付期间出错:必须先发出STARTTLS命令.
有人知道这里的问题是什么吗?
提前致谢!
GAZ
bra*_*ato 35
这对我有用.希望没有其他人像我一样燃烧油来解决这个问题.
这是我的sendmail.ini
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=myemail@gmail.com
auth_password=yourgmailpassword
force_sender=myemail@gmail.com
Run Code Online (Sandbox Code Playgroud)
php/php.ini ----除了sendmail_path和mail.add_x_header之外,基本上都要注释掉所有内容
[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
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"
Run Code Online (Sandbox Code Playgroud)
我更新了sendmail文件后,这对我有用(旧的不支持smtp)
当我遇到这个问题时,我正在localhost上进行密码恢复php.我需要向用户发送密码. - 你的PHP看起来很好
aub*_*pwd 13
好的,今天,最好的答案对我不起作用.但是,这样做了:
在sendmail.ini中:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=****@gmail.com
auth_password=*******
force_sender=****@gmail.com
Run Code Online (Sandbox Code Playgroud)
在php.ini中:
[mail function]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
Run Code Online (Sandbox Code Playgroud)
基于端口@:http://support.google.com/mail/bin/answer.py?hl = zh-CN&answer = 13287
| 归档时间: |
|
| 查看次数: |
93889 次 |
| 最近记录: |