如何在我的php联系表单上修复我的电子邮件标题

时间:2016-06-23 17:13:39

标签: php string contact-form

在我的网站上,当我的客户填写表格时,我收到了电子邮件,但是收到了“发件人”部分,而不是在我收到的表格中显示客户输入的内容“my.hosting.user.name@inmotionhosting.com” 。我想解决这个问题,以便我可以直接回复客户输入到表单中的电子邮件。这是我的contact.php下面的内容。

<?php
// variables start
$name = "";
$email = "";
$message = "";

$name =  trim($_POST['contactNameField']);
$email =  trim($_POST['contactEmailField']);
$message =  trim($_POST['contactMessageTextarea']);
// variables end

// email address starts
$emailAddress = 'info@mydomain.com';
// email address ends

$subject = "mydomain.com | Mobile - Message From: $name";   
$message = "<strong>From:</strong> $name <br/> <strong>E-Mail:</strong> $email </br><br/> <strong>Message:</strong> $message";

$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=iso-8859-1' . "\r\n";

//send email function starts
mail($emailAddress, $subject, $message, $headers);
//send email function ends
?>

1 个答案:

答案 0 :(得分:0)

赋值到变量(例如 Map<String, Integer> topicCount = new HashMap<>(); topicCount.put("test", 1); Map<String, List<KafkaStream<byte[], byte[]>>> consumerStreams = consumer .createMessageStreams(topicCount); List<KafkaStream<byte[], byte[]>> streams = consumerStreams.get(topic); 更改其值,而不是追加。首先初始化变量后,您应该使用运算符$headers = …

.=