我的php脚本不发送邮件。怎么了?我需要标题还是其他东西?不支持邮件吗?
lorem ipsum是php没有邮件黑客/bug吗?Lorem ipsum dolor坐好了,敬请光临。半身像,三叶草,锡石,超级灯笼。[医]丁香[医]鹅掌楸属植物。超短耳直径,nec刚毛利奥马蒂斯电子。在亨德里特,没有什么诱惑,
我的index.php
<!-- Form -->
<form action="apply-process.php" method="post" name="apply">
<div class="row">
<div class="six columns">
<label>Your first name</label>
<input class="u-full-width" type="text" placeholder="John" name="first_name">
</div>
<div class="six columns">
<label>Your last name</label>
<input class="u-full-width" type="text" placeholder="Doe" name="last_name">
</div>
</div>
<div class="row">
<div class="six columns">
<label>Your email</label>
<input class="u-full-width" type="text" placeholder="john@doe.com" name="email">
</div>
<div class="six columns">
<label>Memberschip</label>
<select name="memberschip" class="u-full-width" name="membership">
<option value="Option 1">Normal</option>
<option value="Option 2">Donator</option>
<option value="Option 3">eSport member</option>
</select>
</div>
</div>
<label>Message</label>
<textarea class="u-full-width" placeholder="Tell us something about yourself and your hobbies. Remember to include your ingame name and Skype name." name="text"></textarea>
<input class="button-primary" type="submit" value="Submit">
</form>
我的流程页面:
<?php
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$text = $_POST['text'];
$membership = $_POST['membership'];
$to = "administratie@sharp-gaming.nl";
$subject = "New apply from $first_name";
mail ($to, $subject, "From: " . $first_name . $last_name, "Email: " . $email, "Membership: " . $membership, "Message: " . $text);
header('Location: ../index.html');
?>
谢谢你,尤尔
发布于 2015-05-15 21:53:13
邮件函数http://php.net/manual/en/function.mail.php接受4个参数: to、mail、body和headers。
mail ($to,
$subject,
"From: " . $first_name . $last_name,
"Email: " . $email,
"Membership: " . $membership,
"Message: " . $text);
您正在传递它的6个参数。不需要报头。我不知道你想发送什么,但是你的主题、主体和标题都在错误的地方。
也许你想..。
mail ($to,
$subject,
"Message: " . $text,
"From: $first_name $last_name <$email>");
发布于 2015-05-15 21:35:04
也许这能帮上忙。用下面的行替换您的mail()
:
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: ' .$first_name.$last_name. '<' .$email. '>' . "\r\n";
mail($to,$subject,$text,$headers);
https://stackoverflow.com/questions/30269032
复制相似问题