It's day 5 of reading expert analysis, white papers and a myriad of posted mailer classes, but I seem to be so far away of constructing my PHP script to prepare and send a text and attachment email.
Below is the "hash" of different codes I have been able to put together. I am no longer receiving any errors, but absolutely nothing "seems" to happen when I run the following script. ( I have checked the specified file exists in the designated folder).
Anyone who can help, and perhaps explain what part(s) are incorrect and why, I would be grateful.
$to = "martin.thorburn@tiscali.co.uk";
$subject = "A test email";
$random_hash = md5(date('r', time()));
$headers = "From: [email]martin.thorburn@tiscali.co.uk[/email]";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents("../Filestore/Attach.zip")));
//sample of text
$headers .= "\r\nContent-Type: text/plain; charset='iso-8859-1'; boundary=\"PHP-text-".$random_hash."\"";
$headers .= "Content-Transfer-Encoding: 7bit";
$message='\n';
$message.= $_POST['FirstName'];
$message.=' ';
$message.= $_POST['LastName'];
$message.=' of ';
$message.= $_POST['CoName'];
$message.=' has submitted the following Sub-Contractor Form details from your web site\n\n';
//end sample of text
$headers .= "--PHP-text--$random_hash--";
$headers .= "\r\nContent-Type: application/zip; name=Attach.zip; charset='iso-8859-1'; boundary=\"PHP-attach-".$random_hash."\"";
$headers .= "Content-Transfer-Encoding: base64";
$headers .= "Content-Disposition: attachment";
$attachment;
$headers .= "--PHP-attach--$random_hash--";
$headers .= "--PHP-mixed-$random_hash--";
if(mail($to, $subject, $message, $headers)) {
//the rest of the tested mail parameters follow