Ask a Question related to PHP Development, Design and Development.
-
Dan Van Derveer #1
Problems send MIME multipart/alternative mail with php
I have had no success sending multipart/alternative emails with php. I have
tried everyone's various code snippets with no luck. I test the results with
Outlook and Outlook Express. Everytime my boundary tag ends up showing as
part of my message and thus the plain text and html portions show up as one
long blob of unformatted text. Below is the code I am currently using. Any
suggestions would be greatly appreciated.
Thanks,
Dan
The code:
<?php
error_reporting(E_ALL);
//FUNCTION future
multipartmailer($to,$from,$subject,$plaintextsourc e,$htmlsource);
//$boundry="**=-=-=D-=-=-=-MIME-A-Boundry-=-=-N=-=-=-**";
$boundry= "---=".uniqid("MAILDIVIDERS");
//set mime type
$headers="From: Person <ppersom@mail.com>\n";
$headers.= "MIME-Version: 1.0\n";
$headers.="Content-Type: multipart/alternative;
boundary=\"$boundry\"\n";
//these files have the raw message content
$plaintext = file("plaintextcontent.txt");
$html = file("htmlcontent.txt");
//warning for non-MIME lovin' clients
$headers .= "This message is in MIME format. Since your mail reader does not
understand this format, some or all of this message may not be
legible.\n\r\n\r";
// CHOP
$message .= $boundry."\n";
$message .= "Content-Type: text/plain; charset=ISO-8859-1\n";
$message .= "Content-Transfer-Encoding: 8bit\n\r";
foreach($plaintext as $line) {
****$message .=$line;
}
$message .="\n".$boundry."\n";
$message .= "Content-Type: text/html; charset=ISO-8859-1\n";
$message .= "Content-Transfer-Encoding: 8bit\n";
foreach($html as $line) {
****$message .=$line;
}
$message .="\n".$boundry."\n";
mail("me@me.com","Welcome to the Website",$message,$headers);
print $headers."".$message."<br>";
?>
</body>
</html
Dan Van Derveer Guest
-
Mail::Bulkmail - multipart breaks when doing mail merge
Hi, I've been using Mail::Bulkmail for a while now but never had to do both a mail merge and mutlipart togeather. I recently wrote a program that... -
[PHP] mail mime attachment
I've been working on a simple mail attachment script, that is now working. Its pretty well documented in the code. You can download it at... -
send multipart alternative mails using MIME::Entity
Can someone send me some examples on how to send multipart alternative mails using MIME::Entity Thanks Ram -
the script hangs up when i try to send mail with attachments using MAIL::Sender...???
As said in the topic... when i try to send an e-mail message using Mail::Sender the script hangs up before execution of $sender ->... -
CDONTS multipart/alternative text content
I'm using CDONTS and am trying to send an email out which displays in HTML for HTML-enabled clients, and plain text for non-HTML clients. ... -
Manuel Lemos #2
Re: Problems send MIME multipart/alternative mail with php
Hello,
On 08/19/2003 04:56 PM, Dan Van Derveer wrote:That looks like a bug of the mail() function. You may want to try this> I have had no success sending multipart/alternative emails with php. I have
> tried everyone's various code snippets with no luck. I test the results with
> Outlook and Outlook Express. Everytime my boundary tag ends up showing as
> part of my message and thus the plain text and html portions show up as one
> long blob of unformatted text. Below is the code I am currently using. Any
> suggestions would be greatly appreciated.
class that provides an easy interface for composing and sending
multipart/alternative MIME messages and has workarounds for some of the
mail() function problems:
[url]http://www.phpclasses.org/mimemessage[/url]
--
Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
[url]http://www.phpclasses.org/[/url]
Manuel Lemos Guest
-
Dragonbaki #3
Re: Problems send MIME multipart/alternative mail with php
I also hav the same problem while sending mail.... Thanks in advance for any good solutions........
Dragonbaki Guest



Reply With Quote

