PHP的mail配置

本文介绍如何在Windows环境下通过修改php.ini文件配置PHP邮件发送功能,包括SMTP服务器设置、端口指定、发件人地址定义及sendmail路径配置等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Windows ONLY:

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

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

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = "\"\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 = "\xampp\apache\logs\php_mail.log"


testmail.php
<?php
$ret = mail("xxx@xxx.com", "Test mail function.", "Hey,can u receive it?");
echo $ret;
?>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值