Send email with PHP from html form on submit with the same script

前端 未结 8 1867
情深已故
情深已故 2020-11-22 01:22

I want to send an email with PHP when a user has finished filling in an HTML form and then emailing information from the form. I want to do it from the same script that disp

8条回答
  •  伪装坚强ぢ
    2020-11-22 01:26

    Here are the PHP mail settings I use:

    //Mail sending function
    $subject = $_POST['name'];
    $to = $_POST['email'];
    $from = "zenphoto@example.com";
    
    //data
    $msg = "Your MSG 
    \n"; //Headers $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=UTF-8\r\n"; $headers .= "From: <".$from. ">" ; mail($to,$subject,$msg,$headers); echo "Mail Sent.";

提交回复
热议问题