How to configure PHP to send e-mail?

后端 未结 8 1711
星月不相逢
星月不相逢 2020-12-10 07:12

I need to send mail to the users of my website using php script. I have tried using mail function in php.
My code is as follows:

  $to = \"myweb@gmail.co         


        
8条回答
  •  无人及你
    2020-12-10 07:36

    This will not work on a local host, but uploaded on a server, this code should do the trick. Just make sure to enter your own email address for the $to line.

    
                    
                        

    Title


    Name:
    '.$name.'

    Email:
    '.$email.'

    '; //headers $headers = "From: ".$name." <".$email.">\r\n"; $headers = "Reply-To: ".$email."\r\n"; $headers = "MIME-Version: 1.0\r\n"; $headers = "Content-type: text/html; charset=utf-8"; //send $send = mail($to, $subject, $body, $headers); if ($send) { echo '
    '; echo "Success. Thanks for Your Message."; } else { echo 'Error.'; } } ?>


提交回复
热议问题