谁能帮我编写一个代码,该代码可以一次发送带有两个附件的邮件,这些附件已经在服务器上,并且链接路径保存在数据库(MySql)中?
为了机制
至:
从:
主题:
信息:
附件复选框
我只是一个初学者我只知道如何发送邮件我们发出像贝娄这样的附件
<?php
$errors = '';
$myemail = 'admin@mydomain.net'
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "New Mail From: $name";
$email_body = "$message";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: thank-you.html');
}
?>