PHP mail function 'from' address

后端 未结 3 1313
庸人自扰
庸人自扰 2020-11-29 09:38

I\'m not even sure this is possible, however what I\'m trying to do is as follows. I have an HTML form that generates and email using a PHP script. What I want

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 09:58

    Any reason you cant do it in the email headers?

    $to      = 'hello@hello.com';
    $subject = 'my subject';
    $message = 'hello';
    $headers = 'From: '.$email_from_form. "\r\n";
    
    mail($to, $subject, $message, $headers);
    

提交回复
热议问题