使用html设计在php中发送电子邮件 [英] sending email in php with html design
本文介绍了使用html设计在php中发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
以下电子邮件sript适用于文件附件
如何为以下邮件设计html模板
hi all,
following email sript works with the file attachament
how to design html template for the following mail
if(isset($_POST['submit']))
{
//The form has been submitted, prep a nice thank you message
$output = '<h3>Thanks for your file and message!</h3>';
//Deal with the email
$to = $_POST['email'];
$subject = $_POST['subject'];
$email = strip_tags($_POST['email']);
$name = strip_tags($_POST['name']);
$skype = strip_tags($_POST['skype']);
$message = "Posted Question: ".strip_tags($_POST['message'])."\n"."\n";
$attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name'])));
$target_dir = "uploads/";
$target_file = $target_dir . basename($today._.$time._.$_FILES["file"]["name"]);
if($_FILES['file']['name'] != ""){
move_uploaded_file($_FILES['file']['tmp_name'], $target_file);
}
$boundary =md5(date('r', time()));
$headers = "From: $to\r\nReply-To: $to";
$headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\"";
$message .= "Name: ".$name."\n"."\n";
$message .= "Email: ".$email."\n"."\n";
$message .= "Skype ID: ".$skype."\n"."\n";
$message="This is a multi-part message in MIME format.
--_1_$boundary
Content-Type: multipart/alternative; boundary=\"_2_$boundary\"
--_2_$boundary
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
$message
--_2_$boundary--
--_1_$boundary
Content-Type: application/octet-stream; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
$attachment
--_1_$boundary--";
mail($to, $subject, $message, $headers);
}
推荐答案
_POST [' submit']))
{
// 表单已提交,准备好了一条感谢消息
_POST['submit'])) { //The form has been submitted, prep a nice thank you message
output = ' < h3>感谢您的文件和消息!< / h3>';
// 处理电子邮件
output = '<h3>Thanks for your file and message!</h3>'; //Deal with the email
to =
to =
这篇关于使用html设计在php中发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文