gpt4 book ai didi

php - 使用 XAMPP、sendmail 和 gmail smtp 服务器发送邮件

转载 作者:行者123 更新时间:2023-12-01 13:59:56 30 4
gpt4 key购买 nike

<分区>

这看起来相当简单,我的 php 脚本能够执行。但是我从来没有收到邮件。相关代码如下:

php.ini

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

sendmail_path = "C:\xampplite\sendmail\sendmail.exe -t -i"

sendmail.ini

smtp_server=smtp.gmail.com

smtp_port=587
smtp_ssl=auto
default_domain=mydomain.com
error_logfile=error.log
debug_logfile=debug.log
auth_username=username50@gmail.com
auth_password=passpass

force_sender=myemail@gmail.com
hostname=smtp.gmail.com

这里有什么我想念的吗?我的脚本正在向自己发送电子邮件。那不会是个问题吧?

<?php
$to = "blah@gmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com