如何使用自定义消息向电子邮件地址发送电子邮件

时间:2017-03-04 20:03:19

标签: php email

我想将一封确认电子邮件等电子邮件发送到用户已在输入标记中指定的电子邮件地址。 Exampe: 我在输入标签中输入我的电子邮件,然后我会在输入标签中输入的地址收到一封电子邮件。谢谢,如果你知道答案,你可能会发给我一个代码粘贴。(我是一个PHP菜鸟)

1 个答案:

答案 0 :(得分:-1)

<?php 


$recipient = $_POST['email']; //recipient 
$email = "your@domain.com"; //senders e-mail adress 

if((filter_var($email, FILTER_VALIDATE_EMAIL)) && ($robotest == "")) { 

$Name = ($_POST['name']); //senders name 

$mail_body = !!!----> WHAT DO I PUT HERE <----!!!! 

$subject = "Porter Inquiry"; //subject 
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields 

mail($recipient, $subject, $mail_body, $header); //mail command :) 

} else {
  print "You've entered an invalid email address!";
}
?>