This question already has an answer here:
这个问题在这里已有答案:
- PHP mail function doesn't complete sending of e-mail 24 answers
PHP邮件功能没有完成发送电子邮件24个答案
I want to send mail to windows server using php but i am failed to sent mail. Please send the actual code for send mail using Windows server 2008...
我想用PHP发送邮件到Windows服务器,但我没有发送邮件。请使用Windows Server 2008发送实际发送邮件代码...
$name=trim($_POST['name']);
$email=trim($_POST['email']);
$message=trim($_POST['textarea']);
ini_set("SMTP","gmail-smtp-in.l.google.com");
ini_set("smtp_port",25);
ini_set("sendmail_path","/usr/local/bin/sendmail");
ini_set("sendmail_from","$email");
$subject="One Request from ".$name;
$new_msz="My name is:- ".$name ." My Email Id:- ".$email ." Message:- ".$message;
$ new_msz =“我的名字是: - ”。$ name。“我的电子邮件ID: - ”。$ email。“消息: - ”。$ message;
$email_id="akwwwamit@gmail.com";
if(mail($email_id,$subject,$new_msz,$email))
{
$ms="Successfully sent";
$msz=base64_encode($ms);
header("Location:write-us.php?da=$msz");
}
else
{
$ms="Something problem try again";
$msz=base64_encode($ms);
header("Location:write-us.php?da=$msz");
}
1 个解决方案
#1
0
Have you got any mail server (MTA) on this Windows machine? In a windows environment PHP uses SMTP insted of the Linux binary sendmail (or replacement). Just set the SMTP server (it can be Google's one) according to this page: http://php.net/manual/en/mail.configuration.php
你在这台Windows机器上有任何邮件服务器(MTA)吗?在Windows环境中,PHP使用Linux二进制sendmail(或替换)的SMTP。只需根据此页面设置SMTP服务器(可以是Google的服务器):http://php.net/manual/en/mail.configuration.php
You can add local configuration directives to .htaccess file, here are more information: http://php.net/manual/en/configuration.changes.php , just insert something like:
您可以将本地配置指令添加到.htaccess文件,以下是更多信息:http://php.net/manual/en/configuration.changes.php,只需插入如下内容:
SMTP = gmail-smtp-in.l.google.com
#1
0
Have you got any mail server (MTA) on this Windows machine? In a windows environment PHP uses SMTP insted of the Linux binary sendmail (or replacement). Just set the SMTP server (it can be Google's one) according to this page: http://php.net/manual/en/mail.configuration.php
你在这台Windows机器上有任何邮件服务器(MTA)吗?在Windows环境中,PHP使用Linux二进制sendmail(或替换)的SMTP。只需根据此页面设置SMTP服务器(可以是Google的服务器):http://php.net/manual/en/mail.configuration.php
You can add local configuration directives to .htaccess file, here are more information: http://php.net/manual/en/configuration.changes.php , just insert something like:
您可以将本地配置指令添加到.htaccess文件,以下是更多信息:http://php.net/manual/en/configuration.changes.php,只需插入如下内容:
SMTP = gmail-smtp-in.l.google.com