简体   繁体   English

PHP无法发送电子邮件

[英]php can't send email

I have been trying to send a php contact form, but it's not working at all. 我一直在尝试发送php联系表单,但是它根本无法正常工作。 my xampp use 8080 port. 我的xampp使用8080端口。

I though that I have to change some configuration on php.ini or httpd.conf as well. 虽然我必须更改php.ini或httpd.conf上的某些配置。

Please anybody help me. 请任何人帮助我。

Thank you. 谢谢。

this is the script: 这是脚本:

    <?php
    $to = "tiya.vort4@gmail.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "someonelse@example.com";

    $headers = 'From: '.$from."\r\n".
   'Reply-To: '.$from."\r\n" .
   'X-Mailer: PHP/' . phpversion();

   if(mail($to,$subject,$message,$headers)){
     echo "Mail Sent.";
   }

您必须配置与xampp捆绑在一起的水银服务器 ,才能实际传递/中继邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM