472,967 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,967 software developers and data experts.

multipart mime mail problem

ceh
Hi, on windows xp I'm using

xampp v 1.6.4

I'm trying to send mail. The mail always sends, but the multipart
sections are broken. Essentially, I want to send an html email that
has a link it, like http://www.google.com so the reader can click on
the link.

When I get the email, the body is empty.

It seems that No matter what I can't get multiple newlines before the
boundry sections.
I've tried just \n, just \r, \r\n, \r\n\r\n, \n\n and more
variations....
Perhaps the problem isn't the newlines?

I had some code that worked on linux, but I've never got it to work on
windows.

The code and email follow.

Can anyone tell me how to get this working?

Thanks
// Code Start

<?php
define("CRLF", chr(0x0D) . chr(0x0A));
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<body>

<?php

$body = "From: chupper@localhost" . CRLF .
"MIME-Version: 1.0" . CRLF .
"Content-Type: multipart/alternative; " . CRLF .
" boundary=\"----=_Part_15337_8253480.1197250275132\"" . CRLF .

"------=_Part_15337_8253480.1197250275132" . CRLF .
"Content-Type: text/plain; charset=ISO-8859-1" . CRLF .
"Content-Transfer-Encoding: 7bit" . CRLF .
"Content-Disposition: inline" . CRLF . CRLF .

">" . CRLF .
"http://http://www.google.com" . CRLF .
">" . CRLF . CRLF .

"------=_Part_15337_8253480.1197250275132" . CRLF .
"Content-Type: text/html; charset=ISO-8859-1" . CRLF .
"Content-Transfer-Encoding: 7bit" . CRLF .
"Content-Disposition: inline" . CRLF . CRLF .

"<a href=\"http://http://www.google.com\"><h4>some stuff</h4></a>" .
CRLF . CRLF .

"------=_Part_15337_8253480.1197250275132--";

mail( "chupper@localhost", "Some subject", NULL, $body );

?>

<hr>

<textarea name="debug" rows="20" cols="80" id="id_debug" ><?php echo
$body ?></textarea>

</body>

</html>

// Code End

I get the message with outlook express

// Message Start

Received: from spooler by localhost (Mercury/32 v4.01b); 10 Dec 2007
17:28:07 -0500
X-Envelope-To: <chupper@localhost>
Return-path: <chupper@localhost>
Received: from CLIFF (127.0.0.1) by localhost (Mercury/32 v4.01b) ID
MG000033;
10 Dec 2007 17:28:03 -0500
Date: Mon, 10 Dec 2007 17:28:03 -0500
Subject: Some subject
To: chupper@localhost
From: chupper@localhost
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_15337_8253480.1197250275132"
------=_Part_15337_8253480.1197250275132
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
>
http://http://www.google.com
------=_Part_15337_8253480.1197250275132
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<a href="http://http://www.google.com"><h4>some stuff</h4></a>
------=_Part_15337_8253480.1197250275132--
// Message End
Dec 10 '07 #1
4 2839
ceh wrote:
Hi, on windows xp I'm using

xampp v 1.6.4

I'm trying to send mail. The mail always sends, but the multipart
sections are broken. Essentially, I want to send an html email that
has a link it, like http://www.google.com so the reader can click on
the link.
Why not use one of the many HTML email classes that are already out there in
the internet?

Dec 10 '07 #2
ceh
On Dec 10, 5:38 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
ceh wrote:
Hi, on windows xp I'm using
xampp v 1.6.4
I'm trying to send mail. The mail always sends, but the multipart
sections are broken. Essentially, I want to send an html email that
has a link it, likehttp://www.google.comso the reader can click on
the link.

Why not use one of the many HTML email classes that are already out there in
the internet?
Well, I was using an html email class that works on unix... I just
can't get it to work on windows.
Dec 10 '07 #3
ceh
I seem to have this working now.

It seems I had to enable the following line in my php.ini...
This doesn't makes sense to me though because it says for unix only

; For Unix only. You may supply arguments as well (default: "sendmail
-t -i").
sendmail_path = "d:\xampp\sendmail\sendmail.exe -t"

Additionally, if I ran a local smtp server before this change, the
mails were routed, they were just broken.

I also read elsewhere that php mail talks directly to the mta. This
implies to me the smtp server. perhaps that's an incorrect
assumption.

So, why is it I need to use the local sendmail exe when the php mail
call was working, at least sending email without it?

Thanks
Dec 10 '07 #4
Hello,

on 12/10/2007 08:55 PM ceh said the following:
On Dec 10, 5:38 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
>ceh wrote:
>>Hi, on windows xp I'm using
xampp v 1.6.4
I'm trying to send mail. The mail always sends, but the multipart
sections are broken. Essentially, I want to send an html email that
has a link it, likehttp://www.google.comso the reader can click on
the link.
Why not use one of the many HTML email classes that are already out there in
the internet?

Well, I was using an html email class that works on unix... I just
can't get it to work on windows.
You may want to try this very popular class that works under anything
and deals with line breaks correctly:

http://www.phpclasses.org/mimemessage
--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Dec 11 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: LRW | last post by:
Because I've had recipients of our newsletter tell us they can't (or won't) receive HTML e-mail, I found out how to make an e-mail that sends both HTML and a plaintext version in a multipart...
2
by: Damien | last post by:
Hi to all, After hours of attempts and "googling", I'm still pulling my hair off my head when I try to send multipart html emails. It "works" on PCs with Outlook when I juste send a single...
5
by: lucanos | last post by:
Hey All, I'm having trouble trying to create a PHP file which will generate a multipart email message (containing both an HTML formatted part and a Plain Text formatted part). I have Googled...
3
by: c# newbie | last post by:
System.Web.Mail.MailFormat The enumerated values for MailFormat are: Html Text How can I send a multipart/alternative format message ?
0
by: Guoqi Zheng | last post by:
Dear sir, I am using my own tcpclient code to send email instead of using CDO. Question, I would like the mail message to be in mime multipart format. I am not familiar with mime. Does any...
2
by: Der tolle Emil | last post by:
Hi! I wrote a little function to send emails which works quite well. I already managed to send attachments correctly (also more than 1 per email) but I am not able to send a HTML mail containing...
2
by: Reine | last post by:
Hi We are trying to consume web services provided by an external system. This system uses multipart mime to receive and send binary data. As I've understood it, WSE 3.0 doesn't support that...
0
by: sachintandon | last post by:
Hello all, Thanks in advance for your help I have a problem in sending emails, my requirement is to send multipart alternative emails with attachments, I'm able to send text with attachments or...
2
by: madmak | last post by:
Hi, I am a noob with PHP and need some asistance regarding PHP and lotus notes. I am trying to create a multipart message in PHP to send mail via lotus notes. Here is the code snippet. ...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.