I have 12 field form
One field is file (How to validate for .doc, .docx, .pdf)

How to send all information and file as email?

I found complicated codes. Can anybody help with simple one?

Recommended Answers

All 7 Replies

A Simple methode is

upload your file to your server location and take that uploaded file path.
Attach this filepath to your mail content for download this file.

can you help with coding?

mail($to,$subject,$message,$headers);

How to include filepath to this code?

Thanks for this helpful tips

I think what Bachov is suggesting is that you have the file onlineand available for download, and you put the URL to the file into the body of the email. This is certainly the simplest way, but if you really want to send the file as an attachment these are two pages that came up on a google search for me:
http://www.finalwebsites.com/forums/topic/php-e-mail-attachment-script
http://www.webcheatsheet.com/php/send_email_text_html_attachment.php

Exg:

<?php
$txtName=$_POST['txtName'];
$txtEmail=$_POST['txtEmail'];
$fileName=$_POST['fileName'];
$txtIndustry=$_POST['txtIndustry'];
$txtCountry=$_POST['txtCountry'];
$txtCompensation=$_POST['txtCompensation'];
$currentPage=$_POST['currentpage'];
$host=$_SERVER['HTTP_HOST'];
$download='<tr><td colspan="2">Downloads: <a href="http://'.$host.'/filepath/'.$fileName.'"  target="_blank" >'.$fileName.'</a></td></tr>';


$enquiry='<table width=700 border=0 cellspacing=2 cellpadding=2 align=center>
<tr><td align=right width=100>Name: </td><td>'.$txtName.'</td></tr>
<tr><td align=right width=100>Email: </td><td>'.$txtEmail.'</td></tr>
<tr><td align=right width=100>Industry: </td><td>'.$txtIndustry.'</td></tr>
<tr><td align=right width=200>Preferred Country: </td><td>'.$txtCountry.'</td></tr>
<tr><td align=right width=200>Expected Compensation: </td><td>'.$txtCompensation.'</td></tr>
'.$download.'
</table>';

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

$headers .= "From:info@your.com\r\n";

$user="info@your.com";

mail($user,"Your Web Info", $enquiry, $headers);

?>

Bachov Varghese

Thanks
This code works fine

Can anyone help me to submit above info using jQuery?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.