php.ini,sendmail配置以使用php脚本发送电子邮件 [英] php.ini, sendmail configuration to send an email using a php script

查看:146
本文介绍了php.ini,sendmail配置以使用php脚本发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助。我正在尝试从php脚本发送电子邮件。我的环境包括以下内容:

I need some help. I am trying to send an email from a php script. My environment comprises of the following:


操作系统:Windows 8

Operating System: Windows 8

XAMPP版本:1.8.2

XAMPP version: 1.8.2

php版本:5.4.19

php version: 5.4.19

我有以下php脚本:

<?php
mail('sugar.donkey@gmail.com','Helo','This is a test','From:salt@goodness.com');
?>

发送邮件配置文件上的以下配置:

The following configuration on send mail configuration file:

smtp_server=smtp.gmail.com

; smtp port (normally 25)

smtp_port=465

auth_username=sugar.donkey+gmail.com
auth_password=[MYPASSWORDHERE]

php.ini上的配置:

The configurations on php.ini:

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury

; SMTP = smtp.gmail.com

; smtp_port = 465

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

我没有收到错误当我运行php脚本时,但我似乎也没有收到电子邮件。我在哪里错了?

I dont get error when I run the php script, but I also dont seem to receive an email. Where am I going wrong ?

推荐答案

不过,我不确定您的网络服务器上正在运行什么操作系统;

I am not sure what os you are running on your webserver, however;

大多数Linux安装中都已预先安装sendmail,始终存在设置SPF / PTR记录的麻烦,以确保您的PHP脚本发送的电子邮件不会被标记为垃圾邮件。一个名为MSMTP的SMTP客户端可用于使用第三方SMTP服务器发送电子邮件,也可以由PHP的mail()代替sendmail来使用。

Most Linux installations have sendmail preinstalled, there is always a hassle of setting up SPF/PTR records, to ensure that the email sent by your PHP script is not flagged as spam. A SMTP client called MSMTP can be used to send emails using third-party SMTP servers, this can also be used by PHP's mail() in the place of sendmail.

I希望对您有帮助

https://www.digitalocean.com/community/articles/how-to-use-gmail-or-yahoo-with-php-mail-function

对于localhost测试,也请检查一下。
http://blogs.bigfish.tv/adam/2009/12/03/setup-a-testing-mail-server-using-php-on-mac-os-x/

Also for localhost testing, check this out. http://blogs.bigfish.tv/adam/2009/12/03/setup-a-testing-mail-server-using-php-on-mac-os-x/

这篇关于php.ini,sendmail配置以使用php脚本发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆