i have one form which collect user information
Name
Age
CV
and then i submit that form via jquery to send email
i have following code
var a= $('#a').attr('value');
var b= $('#b').attr('value');
$j.ajax({
type: "POST",
url: "sendemail.php",
data: "a="+ a +"&b="+ b,
success: function(html){
.............
this function works file but i am unable to find a way to verify file as MSWORD or PDF and then attach and send email.
and i am using php mail() function to send email
$Headers = "MIME-Version: 1.0\n";
$Headers .= "Content-type: text/html; charset=iso-8859-1\n";
$Headers .= "From: ".$FromName." <".$FromEmail.">\n";
$Headers .= "Reply-To: ".$ReplyTo."\n";
$Headers .= "X-Sender: <".$FromEmail.">\n";
$Headers .= "X-Mailer: PHP\n";
$Headers .= "X-Priority: 1\n";
$Headers .= "Return-Path: <".$FromEmail.">\n";
if(mail($ToEmail, $Subject, $Content, $Headers) == false) {
echo "2";
}
else
{
echo "1" ;
}
my basic question is:
1. how to validate file (only MSWORD and PDF)
2. send file to sendemail.php via AJAX to attach with email.
Thanks
You could use PHPMailer library which handles email very nicely. You could send emails with attachments to multiple recipients at a time using this library.