简体   繁体   English

需要帮助添加代码以将此发送到我的电子邮件地址

[英]Need Help Adding code to make this send to my email address

I made this contact form, and when you hit send it brings you to a thank you screen, but I do not know how to make it send to my email address.我制作了此联系表格,当您点击发送时,它会将您带到一个感谢屏幕,但我不知道如何将其发送到我的电子邮件地址。 If someone can help me with that I would appreciate it.如果有人可以帮助我,我将不胜感激。

ContactUs html file联系我们 html 文件

<form action="mail.php" method="post">
<p>Name</p> <input type="text" name="name">
<p>Email</p> <input type="text" name="email">

<p>Priority</p>
<select name="priority" size="1">
<option value="Low">Low</option>
<option value="Normal">Normal</option>
<option value="High">High</option>
</select>
<br />

<p>Type</p>
<select name="type" size="1">
<option value="update">Question</option>
<option value="change">Information Change</option>
<option value="addition">Information Addition</option>
<option value="new">Misc.</option>
</select>
<br />

<p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
<input type="submit" name="sendemail" value="Send"><input type="reset" value="Clear">
</form>

mail php file邮件 php 文件

<?php
if(isset($_POST["sendemail"]))
{
$name = $_POST['name'];
$email = $_POST['email'];
$priority = $_POST['priority'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n Priority: $priority \n Type: $type \n Message: $message";
$recipient = "dnasim09@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='form.html' style='text-           decoration:none;color:#ff0099;'> Go Somewhere you are already home ;)</a>";
}
?>

try this https://github.com/PHPMailer/PHPMailer试试这个https://github.com/PHPMailer/PHPMailer

you can configure an smtp to send emails, I guess the problem with your code is that your server does not have any email sending method, you need an smtp to send emails你可以配置一个smtp来发送电子邮件,我猜你的代码的问题是你的服务器没有任何电子邮件发送方法,你需要一个smtp来发送电子邮件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM