summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2015-07-22 09:37:07 +0200
committerBenny Baumann <BenBE@geshi.org>2015-07-22 09:37:07 +0200
commit3d69a10d61d29b33a14db2bc6861d4129d7cdfda (patch)
treeed2882f82d00ff5ec876161d264009e69a75a83d
parent03cb079aba82af5f627f9c2de7b486aff3b1e26b (diff)
parent3bfd196d673ccdba2b60321da8a2666eb1d3b83d (diff)
downloadcacert-devel-3d69a10d61d29b33a14db2bc6861d4129d7cdfda.tar.gz
cacert-devel-3d69a10d61d29b33a14db2bc6861d4129d7cdfda.tar.xz
cacert-devel-3d69a10d61d29b33a14db2bc6861d4129d7cdfda.zip
Merge branch 'bug-1389' into testserver-stable
-rw-r--r--includes/mysql.php.sample26
1 files changed, 19 insertions, 7 deletions
diff --git a/includes/mysql.php.sample b/includes/mysql.php.sample
index d246f8f..f08b975 100644
--- a/includes/mysql.php.sample
+++ b/includes/mysql.php.sample
@@ -25,7 +25,7 @@
$_SESSION['_config']['normalhostname'] = "www.cacert.org";
$_SESSION['_config']['securehostname'] = "secure.cacert.org";
- function sendmail($to, $subject, $message, $from, $replyto = "", $toname = "", $fromname = "", $errorsto = "returns@cacert.org", $extra="")
+ function sendmail($to, $subject, $message, $from, $replyto = "", $toname = "", $fromname = "", $errorsto = "returns@cacert.org", $use_utf8 = true)
{
$lines = explode("\n", $message);
$message = "";
@@ -48,7 +48,7 @@
$smtp = fsockopen("localhost", 25);
if(!$smtp)
{
- echo("Could not connect to mailserver at localhost:25\n");
+ echo("Could not connect to mailserver at localhost:25\n");
return;
}
$InputBuffer = fgets($smtp, 1024);
@@ -85,16 +85,28 @@
if($extra == "")
{
fputs($smtp, "Content-Type: text/plain; charset=\"utf-8\"\r\n");
- fputs($smtp, "Content-Transfer-Encoding: 8bit\r\n");
- } else {
+ }
+ else
+ {
fputs($smtp, "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n");
- fputs($smtp, "Content-Transfer-Encoding: quoted-printable\r\n");
- fputs($smtp, "Content-Disposition: inline\r\n");
}
+ fputs($smtp, "Content-Transfer-Encoding: quoted-printable\r\n");
+ fputs($smtp, "Content-Disposition: inline\r\n");
+
// fputs($smtp, "Content-Transfer-Encoding: BASE64\r\n");
fputs($smtp, "\r\n");
// fputs($smtp, chunk_split(base64_encode(recode("html..utf-8", $message)))."\r\n.\r\n");
- fputs($smtp, recode("html..utf-8", $message)."\r\n.\r\n");
+ $encoded_lines = explode( "\n", str_replace("\r", "", $message) );
+ array_walk( $encoded_lines,
+ function (&$a) {
+ $a = quoted_printable_encode(recode("html..utf-8", $a));
+ });
+ $encoded_message = implode("\n", $encoded_lines);
+
+ $encoded_message = str_replace("\r.", "\r=2E", $encoded_message);
+ $encoded_message = str_replace("\n.", "\n=2E", $encoded_message);
+ fputs($smtp, $encoded_message);
+ fputs($smtp, "\r\n.\r\n");
fputs($smtp, "QUIT\n");
$InputBuffer = fgets($smtp, 1024);
fclose($smtp);