User blog comment:Kirkburn/Technical Update: April 13, 2015/@comment-452-20150418194704

So I decided to write a php script for my server to intercept the HTML emails and convert them to plaintext and deliver it to me, but I ran into a slight problem which has enlightened me as to why the emails are so large, and the real reason plain text emails are no longer available: every single link in the email is a tracking URL instead of a direct link to Wikia.

Here's a sample "Compare changes" button: Compare changes 

"All of the normal links you'd expect are included"

- From the blog post.

Nope. I expect normal human-readable link like http://dev.wikia.com/wiki/WHAM?diff=25864&oldid=25748

I'm sure the information Wikia gets from tracking email clicks will be very informational, and help Wikia improve their services, but I would have a lot more respect for Wikia if they were more upfront about their intentions.

In case anyone is interested, here is the PHP script.

As it is, emails are forwarded as-is if it is not a multi-part email with a blank text/plain portion, and if there is a blank text/plain portion, the processed email only links to Special:RecentChanges - which is better than either a blank email or tracking URLs. <?	$email = file("php://stdin"); list($email_header,$email_body) = explode("\n\n",implode("",$email), 2); $email_body = str_replace(["=3D","=\n"],["="],$email_body); $email_header = preg_replace('/\n(\s)/', '$1', $email_header); foreach(explode("\n", $email_header) as $headerline) { list($key, $val) = explode(": ", $headerline, 2); $email_headers[$key] = $val; }	if (strpos ( $email_headers["Content-Type"], "multipart") !== false) { preg_match('/boundary="?([^"]+)?"/i', $email_headers["Content-Type"], $matches);		$email_bodyparts = explode("--".$matches[1], $email_body);		$email_bodyparts = array_slice($email_bodyparts, 1, -1);

foreach ($email_bodyparts as $email_bodypart) { list($email_mimeheader, $email_mimebody) = explode("\n\n", $email_bodypart, 2); $email_mimeheader = preg_replace('/\n(\s)/', '$1', $email_mimeheader); foreach(explode("\n", $email_mimeheader) as $mimeheader) { list($key, $val) = explode(": ", $mimeheader, 2); $mimeheaders[$key] = $val; }			if ((strpos ( $mimeheaders["Content-Type"], "text/plain") !== false) && (strpos ( $email_mimebody, "http") === false ) ) {	$WikiaNotOnlyDoesNotCareAboutTextPlainButWantsToMakeSureYouKnowIt = true; $email_textbody = $email_mimebody; }

if (strpos ( $mimeheaders["Content-Type"], "text/html") !== false && $WikiaNotOnlyDoesNotCareAboutTextPlainButWantsToMakeSureYouKnowIt) { preg_match('/@(.*)?>/', $email_headers["Message-ID"], $matches); $email_newbody = "\nhttp://".$matches[1]."/wiki/Special:RecentChanges?from=".gmdate('YmdHi00', strtotime($email_headers["Date"]))."\n".$email_textbody; // Although not all wikis have /wiki/ in the URL, there is no way from the email to tell whether it is necessary. Leaving it out breaks the url for wikis which do have it. }																																	}	}	if (!$email_newbody) $email_newbody = $email_body; $name = "wikia (processed)"; $headers = "From: ".$name." <".$_SERVER["SENDER"].">\r\n"; $headers .= "Return-Path: ".$_SERVER["SENDER"]."\r\n"; ini_set("sendmail_from", $_SERVER["SENDER"]); mail($_SERVER["RECIPIENT"], stripslashes($email_headers["Subject"]), stripslashes($email_newbody),$headers); ?>