[英]Form Email Output styling
I have created a html form which i inserted into my webpage and have done a php file to send me the details entered into the from via email however, 我创建了一个html表单,将其插入到我的网页中,并完成了一个php文件,以通过电子邮件向我发送输入的详细信息,
and 和
I have looked everywhere to try find a solution but did not find one. 我到处寻找尝试找到一种解决方案,但没有找到解决方案。
Could someone please help please i am really really stuck. 有人可以帮忙吗,我真的很困。
Thank You 谢谢
My HTML code 我的HTML代码
<form method="post" action="/form/php/sendresults.php">
<label>First Name: <input type="text" name="firstname" size="30" maxlength="30" />
</label>
<label>Last Name: <input type="text" name="lastname" size="30" maxlength="30" />
</label>
<textarea name="comments" rows="8" cols="50" style="margin-left:37px" />
</textarea>
<input type="submit" value="submit" />
</form>
PHP CODE PHP代码
<?php
$to = 'info@my.com';
$subject = $firstname;
$message = '
<html>
<head>
<title>'.$firstname.'</title>
</head>
<body>
<p>'.$firstname.'!</p>
<table>
<tr>
<th>Full Name</th><th>Company Name</th><th>Company Registered Number</th><th>Phone Number</th>
</tr>
<tr>
<td>'.$lastname.'</td><td>'.$comments.'</td><td>'.$firstname.'</td><td>'.$firstname.'</td>
</tr>
</table>
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $message, $headers);
?>
The mail
function of PHP is really weak. PHP的mail
功能确实很弱。 I would recommend you use something like mailchimp or mandrill . 我会建议你使用类似mailchimp或山魈 。 You can use Mandrill's API ( It's really easy and works like a charm ) . 您可以使用Mandrill的API(这非常容易,并且像一个吊饰一样工作)。 If you're interested in Mandrill's API, you can learn it on codecademy 如果您对Mandrill的API感兴趣,可以在codecademy上学习
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.