Hello… ok im using wordpress and two plugins called postie (wich lets you post to wordpress from email) and a contactform plugin called dd-formmailer.
both systems work ok, but for some reason when i send a email from the contact form postie doesnt recognize the image (yes the image is attached), however if i send the same image from gmail or another contact form plugin (cforms) it works… the idea is so that user can submit their photos to my blog… but i cant use cforms because dd-formmailer has a lot more options that i use… i figure out that the problem lies within the headers of the email.
can someone help me by correcting dd-formmailer headers?
DD Form Mailer Code: http://www.mysite.info/dd-formmailer.txt
here’s the headers code
[code] $mime_boundary = ‘==Multipart_Boundary_x’ . md5(time()) . ‘x’;
$headers = '';
$msg_headers = '';
$headers .= 'From: ' . $sender_name . ' <' . $sender_email . '>' . $eol;
$headers .= $extra_recips;
$headers .= 'Reply-To: ' . $sender_name . ' <' . $sender_email . '>' . $eol;
$headers .= 'Return-Path: ' . $sender_name . ' <' . $sender_email . '>' . $eol;
$headers .= "Message-ID: <" . time() . "ddfm@" . $_SERVER['SERVER_NAME'] . ">" . $eol;
$headers .= 'X-Sender-IP: ' . $_SERVER["REMOTE_ADDR"] . $eol;
$headers .= "X-Mailer: PHP v" . phpversion() . $eol;
$headers .= 'MIME-Version: 1.0' . $eol;
$headers .= 'Content-Type: multipart/mixed;' . $eol;
$headers .= ' boundary="' . $mime_boundary . '"';
$msg_headers .= 'This is a multi-part message in MIME format.' . $eol . $eol;
$msg_headers .= '--' . $mime_boundary . $eol;
$msg_headers .= 'Content-Type: text/plain; charset=utf-8' . $eol;
$msg_headers .= 'Content-Transfer-Encoding: 8bit' . $eol . $eol;
$msg = $msg_headers . $msg . $eol . $eol;
if (count($attachments) > 0) {
for ($i = 0; $i < count($attachments); $i++) {
if (is_file($attachments[$i]['tmpfile'])) {
$handle = fopen($attachments[$i]['tmpfile'], 'rb');
$f_contents = fread($handle, filesize($attachments[$i]['tmpfile']));
$f_contents = chunk_split(base64_encode($f_contents));
fclose($handle);
$msg .= '--' . $mime_boundary . $eol;
$msg .= 'Content-Type: application/octet-stream;' . "nt" . 'name="' . $attachments[$i]['file'] . '"' . $eol;
$msg .= 'Content-Transfer-Encoding: base64' . $eol;
$msg .= 'Content-Disposition: attachment;' . "nt" . 'filename="' . $attachments[$i]['file'] . '"' . $eol . $eol;
$msg .= $f_contents; //The base64 encoded message
$msg .= $eol;
}
}
}
$msg_headers .= '--' . $mime_boundary . $eol;
ini_set(sendmail_from, $sender_email);
$send_status = mail($send_to, $email_subject, $msg, $headers);
ini_restore(sendmail_from);
return $send_status;
}[/code]
CForms Code: http://www.mysite.info/cforms.txt
thank you in advanced!
phil