邮件不是从localhost发送的 [英] mail not sent from localhost
问题描述
我正在尝试使用核心php代码发送邮件,但它无法正常工作,并且屏幕上没有显示错误。获取已发送邮件的输出但实际邮件中未发送。
以下是code.pls帮助我如何通过此代码发送邮件
if(isset($ _ REQUEST ['send']) )
{
$ t = $ _ POST ['to'];
$ s = $ _ POST ['subject'];
$ b = $ _ POST ['body'];
if(mail($ t,$ s,$ b))
{
echo发送邮件;
}
其他
{
echomail没发送;
}
}
?>
< ; html>
发送邮件
< body>
< form>
to | < input type =textname =to/> |
subject | < input type =textname =subject/> |
body | < input type =textname =body/&g t; |
< input type =submitname =sendvalue =send/> |
以下是php.ini文件中所做的更改
[mail function]
; 对于 Win32 仅。
; http: // php.net/smtp
SMTP = smtp 。 gmail 。 com
; http: // php。 net / smtp-port
smtp_port = 587
; 对于 Win32 仅。
; http: // php.net/sendmail-from
sendmail_from = kakminder @ gmail。 com
; 对于 Unix 仅。 您 可能 supply arguments as well (默认值: sendmail - t -i)。
; http: // php.net/sendmail-path
sendmail_path = \D:\ xampp \ sendmail \ sendmail.exe \-t
这里是在sendmail.php中所做的更改
#用户配置文件的示例
#为所有后续帐户设置默认值。
默认值
logfileD:\ xampp \ sendmail \ sendmail.log
#Mercury
#account Mercury
#host localhost
#from postmaster @ localhost
#auth off
#A免费邮件服务示例
#account Hotmail
#tls on
#tls_certcheck off
#host smtp.live.com
#from [exampleuser] @ hotmail.com < b r />
#auth
#user [exampleuser] @ hotmail.com
#password [examplepassword]
smtp_server = smtp.gmail.com
smtp_port = 587
error_logfile = error.log
debug_logfile = debug.log
auth_username=kakminder@gmail.com
auth_password = 9816537569
force_sender=kakminder@gmail.com
#设置默认帐户
帐户默认值:Gmail
_REQUEST ['send' ]))
{
t =
_POST ['to'];
I am trying to send mail by using core php code but its not working and errors are not displayed on screen.Getting output of mail sent but in actual mail is not getting sent.
below is the code.pls help me how can i send mail through this code
if(isset($_REQUEST['send']))
{
$t=$_POST['to'];
$s=$_POST['subject'];
$b=$_POST['body'];
if(mail($t,$s,$b))
{
echo "mail sent";
}
else
{
echo "mail not sent";
}
}
?>
<html>
Sending mail
<body>
<form>
to | <input type="text" name="to" /> |
subject | <input type="text" name="subject" /> |
body | <input type="text" name="body" /> |
<input type="submit" name="send" value="send" /> |
below are the changes made in php.ini file
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP =smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = kakminder@gmail.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"
here is the changes made in sendmail.php
# Example for a user configuration file
# Set default values for all following accounts.
defaults
logfile "D:\xampp\sendmail\sendmail.log"
#Mercury
#account Mercury
#host localhost
#from postmaster@localhost
#auth off
#A freemail service example
#account Hotmail
#tls on
#tls_certcheck off
#host smtp.live.com
#from [exampleuser]@hotmail.com
#auth on
#user [exampleuser]@hotmail.com
#password [examplepassword]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=kakminder@gmail.com
auth_password=9816537569
force_sender=kakminder@gmail.com
# Set a default account
account default : Gmail
_REQUEST['send']))
{
t=
_POST['to'];
这篇关于邮件不是从localhost发送的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!