Ok, I submitted this issue to the bug tracker and it was dismissed as a non-issue. I then updated my versions Email.php. Mailer.php and SS_Viewer.php to the latest trunk versions, and it still is an issue.
In the end, I created a basic class wrapper on Email, and replaced the processVariables function. There is a suspicious looking for loop in there that does alter all of the headers that are getting changed, so now I have:
class GFEmail extends Email
{
/**
* Load all the template variables into the internal variables, including
* the template into body. Called before send() or debugSend()
* $isPlain=true will cause the template to be ignored, otherwise the GenericEmail template will be used
* and it won't be plain email :)
*/
protected function parseVariables($isPlain = false) {
if(!$this->parseVariables_done) {
$this->parseVariables_done = true;
// Parse $ variables in the base parameters
$data = $this->templateData();
/* nuked this
foreach(array('from','to','subject','body', 'plaintext_body', 'cc', 'bcc') as $param) {
$template = SSViewer::fromString($this->$param);
$this->$param = $template->process($data);
}
*/
// Process a .SS template file
$fullBody = $this->body;
if($this->ss_template && !$isPlain) {
// Requery data so that updated versions of To, From, Subject, etc are included
$data = $this->templateData();
$template = new SSViewer($this->ss_template);
if($template->exists()) {
$fullBody = $template->process($data);
}
}
// Rewrite relative URLs
$this->body = HTTP::absoluteURLs($fullBody);
}
}
}
and all seems to be working fine for my needs, hopefully this can help somebody else if they experience the same issue.