Hello -
This will be moderate to hard task for someone familiar with classes and mime. This script works...almost. The author is completely lost at this point and I needed this yesterday. What I need is to merely have the Content-Types and their Content-Transfer-Encodings switched around so this displays correctly in web-based email clients like aol and yahoo. I've tried myself but without success. The script changes as the inputs change. Perhaps you can help.
This script runs from inputs from my form page which looks like this:
<input type="text" name="to" value="To Email">
<select name="pic" value="Select Image">
<textarea name="comments" wrap="virtual" cols="40" rows="4"></textarea>
The above inputs then go to the below php page:
<?php
require("class.phpmailer.php");
$mail = new phpmailer();
$mail->From = "from@email.com"; // From email address
$mail->FromName = "Graphix and Sound"; // From name on email
$mail->AddAddress("$to"); // name is optional
$mail->AddReplyTo("doofy@home.com", "Information"); // Reply address
$mail->WordWrap = 0; // set word wrap to 50 characters
$mail->AddEmbeddedImage("$pic.gif","mypic"); //Embedded Image
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Your Order Has Arrived";
$mail->Body = " <body text=#ffffff bgcolor=#000000><center><img src=\"cid:mypic\"></center><br><table align=center border=2 outset=#ff00ff bgcolor=#000077><tr>
<td><font face=verdana color=red size=3> $comments</font></td>
</tr></table>";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Your order has been sent!";
?>
Current email source code below:
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="b1_b630bab1de9933696842f2cd68305b3f"
X-MM-Mail-From-Script: /zoobie/zoobiesmail.php
X-Complains-To: abuse@lycos.co.uk
X-MM-Mail-From-IP: 172.191.31.34
Errors-To: zoobie@lycos.co.uk
Message-Id: <20020615100133.86EE15E0F@wmphpf02.lyceu.net>
--b1_b630bab1de9933696842f2cd68305b3f
Content-Type: text/html; charset = "iso-8859-1"
<body text=#ffffff bgcolor=#000000><center><img src="cid:mypic"></center><br><table align=center border=2 outset=#ff00ff bgcolor=#000077><tr>
<td><font face=verdana color=red size=3>This is my test text in html.</font></td>
</tr></table>">
--b1_b630bab1de9933696842f2cd68305b3f
Content-Type: image/gif; name="smiley.gif"
Content-Transfer-Encoding: base64
Content-ID: <mypic>
Content-Disposition: inline; filename="smiley.gif"
(Smiley data here)
--b1_b630bab1de9933696842f2cd68305b3f--
Now for the switch. I need the above to come out like the below's format taken from Outlook Express. This MUST be used so I know they display correctly in web-based email unlike the above source code:
MIME-Version: 1.0
Content-Type: multipart/related;
type="multipart/alternative";
boundary="----=_NextPart_000_0050_01C20DE0.47BD0300"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
------=_NextPart_001_0051_01C20DE0.47BD0300
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><EM><FONT color=3D#800080=20
size=3D4><CENTER><IMG=20
alt=3D"" hspace=3D0 src=3D"cid:004e01c20e12$90477ec0$4ed5c0ac@t5m2z9" =
align=3Dbaseline=20
border=3D0></CENTER></FONT></EM></DIV>
<DIV><EM><FONT color=3D#800080=20
size=3D4>This is my test text in html</FONT></EM></DIV>
<DIV> </DIV></BODY>
------=_NextPart_001_0051_01C20DE0.47BD0300--
------=_NextPart_000_0050_01C20DE0.47BD0300
Content-Type: image/gif;
name="smiley.gif"
Content-Transfer-Encoding: base64
Content-ID: <004e01c20e12$90477ec0$4ed5c0ac@t5m2z9>
(SMILEY.GIF DATA HERE)
------=_NextPart_000_0050_01C20DE0.47BD0300--
Basically, you 'll have to find the two content-types and their content-transfer-encoding above in the required class.phpmailer.php file here @ http://geocities.com/zoobie007/formailer.txt and switch them around to match the Outlook Express model.
As usual, this may not be as simple as presented.
Thank you very much and good luck!
Sincerely,
Z