wordpress, images and mail..


#1

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


#2

Try sending the same message through your form and gmail, and compare those when you receive them (headers, source, etc). I don’t know much about mail(), and I know next to nothing about third-party software or plugins, but I do know that if you get different results, something’s gotta be off.


#3

yes i tried doing that and i compard the headers… but i dont know anything about mail() func… so im still looking around for answers.

thanks you!


#4

any ways here are the headers info and stuff

form sent mail

[code]Delivered-To: xxx.xxx@gmail.com
Received: by 10.114.196.17 with SMTP id t17cs1493917waf;
Fri, 23 Mar 2007 15:54:57 -0700 (PDT)
Received: by 10.70.87.5 with SMTP id k5mr6638889wxb.1174690493247;
Fri, 23 Mar 2007 15:54:53 -0700 (PDT)
Return-Path: xxx@panda.ultrawhb.com
Received: from panda.ultrawhb.com (panda.ultrawhb.com [65.98.6.51])
by mx.google.com with ESMTP id i14si4809226wxd.2007.03.23.15.54.42;
Fri, 23 Mar 2007 15:54:53 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of xxx@panda.ultrawhb.com designates 65.98.6.51 as permitted sender)
Received: from xxx by panda.ultrawhb.com with local (Exim 4.63)
(envelope-from xxx@panda.ultrawhb.com)
id 1HUseX-0006DV-JT
for xxx.xxx@gmail.com; Fri, 23 Mar 2007 22:54:33 +0000
To: xxx.xxx@gmail.com
Subject: Philsen
From: Philipp Berndt xxx.xxx@gmail.com
Reply-To: Philipp Berndt xxx.xxx@gmail.com
Message-ID: 1174690473ddfm@www.xxx.com
X-Sender-IP: 190.47.165.201
X-Mailer: PHP v4.4.6
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="==Multipart_Boundary_xc72f94069700877863f11941653fc59ax"
Date: Fri, 23 Mar 2007 22:54:33 +0000
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - panda.ultrawhb.com
X-AntiAbuse: Original Domain - gmail.com
X-AntiAbuse: Originator/Caller UID/GID - [32208 500] / [47 12]
X-AntiAbuse: Sender Address Domain - panda.ultrawhb.com
X-Source: /usr/bin/php
X-Source-Args: /usr/bin/php index.php
X-Source-Dir: mysite.info:/public_html/lindasdefotolog

This is a multi-part message in MIME format.

–==Multipart_Boundary_xc72f94069700877863f11941653fc59ax
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

:start
blah
:end

IP: 190.47.165.201 HOST: pc-201-165-47-190.cm.vtr.net

–==Multipart_Boundary_xc72f94069700877863f11941653fc59ax
Content-Type: image/jpeg;
name=“01.jpg”
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment;
filename=“01.jpg”

/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE[…]oor0MJhKdOnKMZTac29XG9+WK6RXYD//2Q==

[/code]

and for the gmail sent email

Received: by 10.114.196.17 with HTTP; Fri, 23 Mar 2007 15:56:50 -0700 (PDT)
Message-ID: <6d2f1a800703231556j522c1ab7jb56123f38a1359c1@mail.gmail.com>
Date: Fri, 23 Mar 2007 18:56:50 -0400
From: "Philipp Berndt" <xxx.xxx@gmail.com>
To: xxx.xxx@gmail.com
Subject: Philsen
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_232045_30808873.1174690610588"
Delivered-To: xxx.xxx@gmail.com

------=_Part_232045_30808873.1174690610588
Content-Type: multipart/alternative; 
	boundary="----=_Part_232046_26294074.1174690610588"

------=_Part_232046_26294074.1174690610588
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

blah

------=_Part_232046_26294074.1174690610588
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

blah<br>

------=_Part_232046_26294074.1174690610588--

------=_Part_232045_30808873.1174690610588
Content-Type: image/jpeg; name=01.jpg
Content-Transfer-Encoding: base64
X-Attachment-Id: f_ezn8e3cn
Content-Disposition: attachment; filename="01.jpg"

/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wB[...]D0/4NfBr4k6b8SfDd7e+G/Jtof7Y82X+2NBk2
+ZoOqQp8kWqSSNukkRflQ4zk4UEgoor0MJhKdOnKMZTac29XG9+WK6RXYD//2Q==
------=_Part_232045_30808873.1174690610588--

at the end of the image info from the gmail sent mail theres this

------=_Part_232045_30808873.1174690610588–

could this be it?

anyways… who ever can figure this thing out please help me.

thanks phil