I have a problem with online survey script for them, which is having also email forwarding functionality.
When we tested email forwarding function in one server, it worked fine, but in another web server, there are some problems with MIME alternative/multipart email plain text version. The text is mixed up...and the From address is instead of the actual sender "admin@mail.server.lv" <admin@mail.server.lv>
Do you have any idea, what could be the solution?
I also add the function, which is sending the emails:
function build_html($sender_name, $boundary, $htmlfilename="draft.htm")
{
$f = "Tavs draugs $sender_name Tev iesaka apmeklēt http://www.cassandra.ee/demo/index2.php/action=intro";
$f .= "IespÄ“jams tieÅi Tu laimÄ“si ceļojumu uz SlovÄkiju 2 personÄm vai kÄdu no pÄrsteiguma balvÄm!";
$fp = fopen($htmlfilename, 'r');
$file = fread($fp, filesize($htmlfilename));
fclose($fp);
$msg = "This is a MIME encoded message.\n\n";
$msg.= '--'.$boundary."\n";
$msg .= 'Content-Type: text/plain; charset="utf-8"'."\n";
$msg .= 'Content-Transfer-Encoding: 7-bit."\n\n";
$msg .= quoted_printable_encode($f)."\n\n";
$msg.= '--'.$boundary."\n";
$msg.= 'Content-Type: text/html; charset="UTF-8"'."\n";
$msg.= 'Content-Transfer-Encoding: base64'."\n\n";
$msg.= chunk_split(base64_encode($file))."\n\n";
$msg.= '--'.$boundary."--\n";
return $msg;
}
Below is the sample text-based email:
Content-Type: multipart/alternative;
boundary="=_ea6bc8ee9a86979f03c50eb303420ce1"
From: Pertti Rahnel iesaka <rahnel@one.ee>
X-Mailer: Cassandra
This is a MIME encoded message.
--=_ea6bc8ee9a86979f03c50eb303420ce1
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7-bit
=EF=BB=BFTavs draugs Tev iesaka apmekl=C4=93t http=
--=_ea6bc8ee9a86979f03c50eb303420ce1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: base64
PGh0bWw+DQo8aGVhZD4NCjx0aXRsZT5DYXNzYW5kcmE8L3RpdGxlPg0KPG1ldGEgaHR0cC1lcXVp
--=_ea6bc8ee9a86979f03c50eb303420ce1--