Feature #14780 » HTMLMail_Charset_Fix_2.patch
TYPO3core.htmlmail/t3lib/class.t3lib_dmailer.php 2005-10-20 13:01:58.434047600 +0200 | ||
---|---|---|
*/
|
||
function dmailer_prepare($row) {
|
||
$sys_dmail_uid = $row['uid'];
|
||
if($row["encoding"] != "quoted-printable") {
|
||
$this->useBase64();
|
||
}
|
||
$this->theParts = unserialize($row['mailContent']);
|
||
$this->messageid = $this->theParts['messageid'];
|
||
$this->subject = $row['subject'];
|
||
... | ... | |
$this->dmailer['sectionBoundary'] = '<!--DMAILER_SECTION_BOUNDARY';
|
||
$this->dmailer['html_content'] = base64_decode($this->theParts['html']['content']);
|
||
if (preg_match('/<meta\s+http-equiv="Content-Type"\s+content="text\/html; charset=([^"]+)"\s+\/>/si', $this->dmailer['html_content'], $matches) == 1) {
|
||
// We must set an alternate charset.
|
||
$this->setCharset(trim($matches[1]));
|
||
$this->setContentTypeHeader();
|
||
}
|
||
if($row["encoding"] != "quoted-printable") {
|
||
// Change to base64 (This also set's the Content-Type headers)
|
||
$this->useBase64();
|
||
}
|
||
$this->dmailer['plain_content'] = base64_decode($this->theParts['plain']['content']);
|
||
$this->dmailer['messageID'] = $this->messageid;
|
||
$this->dmailer['sys_dmail_uid'] = $sys_dmail_uid;
|
TYPO3core.htmlmail/t3lib/class.t3lib_formmail.php 2005-10-20 12:30:48.471325144 +0200 | ||
---|---|---|
if (isset($V['recipient'])) {
|
||
// Sets the message id
|
||
$this->messageid = md5(microtime()).'@domain.tld';
|
||
$this->messageid = md5(microtime()).'@'.t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
|
||
$this->subject = ($V['subject']) ? $V['subject'] : 'Formmail on '.t3lib_div::getIndpEnv('HTTP_HOST');
|
||
$this->from_email = ($V['from_email']) ? $V['from_email'] : (($V['email'])?$V['email']:'');
|
TYPO3core.htmlmail/t3lib/class.t3lib_htmlmail.php 2005-10-20 13:15:40.341098736 +0200 | ||
---|---|---|
var $http_username="";
|
||
var $postfix_version1=false;
|
||
var $defaultCharset = 'iso-8859-1'; // The charset which gets used for sending mails when no other is set
|
||
var $usedCharset = ''; // The final charset which will get used for the mails.
|
||
// Internal
|
||
/* This is how the $theParts-array is normally looking
|
||
... | ... | |
*/
|
||
function t3lib_htmlmail () {
|
||
$this->forceReturnPath = $GLOBALS['TYPO3_CONF_VARS']['SYS']['forceReturnPath'];
|
||
$this->setCharset();
|
||
$this->setContentTypeHeader();
|
||
}
|
||
/**
|
||
* Sets the Content-Type Header.
|
||
*
|
||
* @param string The character set to use
|
||
* @param string The encoding to use
|
||
* @return void
|
||
*/
|
||
function setContentTypeHeader($encoding = 'quoted-printable') {
|
||
$this->plain_text_header = 'Content-Type: text/plain; charset='.$this->usedCharset.chr(10).'Content-Transfer-Encoding: '.$encoding;
|
||
$this->html_text_header = 'Content-Type: text/html; charset='.$this->usedCharset.chr(10).'Content-Transfer-Encoding: '.$encoding;
|
||
}
|
||
/**
|
||
* @return [type] ...
|
||
*/
|
||
function start () {
|
||
// Sets the message id
|
||
$this->messageid = md5(microtime()).'@domain.tld';
|
||
$this->messageid = md5(microtime()).'@'.t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
|
||
}
|
||
/**
|
||
... | ... | |
* @return [type] ...
|
||
*/
|
||
function useBase64() {
|
||
$this->plain_text_header = 'Content-Type: text/plain; charset=iso-8859-1'.chr(10).'Content-Transfer-Encoding: base64';
|
||
$this->html_text_header = 'Content-Type: text/html; charset=iso-8859-1'.chr(10).'Content-Transfer-Encoding: base64';
|
||
$this->setContentTypeHeader('base64');
|
||
$this->alt_base64=1;
|
||
}
|
||
... | ... | |
*/
|
||
function convertName($name) {
|
||
if (ereg("[^".chr(32)."-".chr(60).chr(62)."-".chr(127)."]",$name)) {
|
||
return '=?iso-8859-1?B?'.base64_encode($name).'?=';
|
||
return '=?'.$this->usedCharset.'?B?'.base64_encode($name).'?=';
|
||
} else {
|
||
return $name;
|
||
}
|
||
}
|
||
/**
|
||
* Returns the character set used for mails
|
||
*
|
||
* @return string The characterset (i.e. 'iso-8859-1', 'utf-8', etc.)
|
||
*/
|
||
function setCharset($alternateCharset = '') {
|
||
if ($alternateCharset) { // Check if an alternate charset was set (always use it)
|
||
$this->usedCharset = $alternateCharset;
|
||
} elseif ($GLOBALS['TSFE']->tmpl->setup['config.']['htmlmailCharset']) { // FE Mails: An alternate charset was set via TS
|
||
$this->usedCharset = $GLOBALS['TSFE']->tmpl->setup['config.']['htmlmailCharset'];
|
||
} elseif ($GLOBALS['TSFE']->metaCharset) { // If no user setting until now, use this of the actually rendered page (the meta charset as this is how the browser handles the page)
|
||
$this->usedCharset = $GLOBALS['TSFE']->metaCharset;
|
||
} elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']) { // Try to use the forceCharset value if no other was set.
|
||
$this->usedCharset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
|
||
} else { // Fall back to default
|
||
$this->usedCharset = $this->defaultCharset;
|
||
}
|
||
}
|
||
}
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_htmlmail.php']) {
|
- « Previous
- 1
- 2
- Next »