/** * Quote the given address if it needs to be. The address may be a * regular email address, or it can be a phrase followed by an address in * brackets. The phrase is the only part that will be quoted, and only if * it needs to be. This allows extended characters to be used in the * "to", "from", "cc", and "bcc" headers. */ function quoteAddressIfNecessary($address, $charset = AK_ACTION_MAILER_DEFAULT_CHARSET) { if (is_array($address)) { return join(", " . AK_ACTION_MAILER_EOL . " ", AkActionMailerQuoting::quoteAnyAddressIfNecessary($address, $charset)); } elseif (preg_match('/^(\\S.*)\\s+(<?(' . AK_ACTION_MAILER_EMAIL_REGULAR_EXPRESSION . ')>?)$/i', $address, $match)) { $address = $match[3]; $phrase = AkActionMailerQuoting::quoteIfNecessary(preg_replace('/^[\'"](.*)[\'"]$/', '$1', $match[1]), $charset); return "{$phrase} <{$address}>"; } else { return $address; } }
/** * Quote the given address if it needs to be. The address may be a * regular email address, or it can be a phrase followed by an address in * brackets. The phrase is the only part that will be quoted, and only if * it needs to be. This allows extended characters to be used in the * "to", "from", "cc", and "bcc" headers. */ function quoteAddressIfNecessary($address, $charset = AK_ACTION_MAILER_DEFAULT_CHARSET) { if(is_array($address)){ return join(", ".AK_ACTION_MAILER_EOL." ",AkActionMailerQuoting::quoteAnyAddressIfNecessary($address, $charset)); }elseif (preg_match('/^(\S.*)\s+(<?('.AK_ACTION_MAILER_EMAIL_REGULAR_EXPRESSION.')>?)$/i', $address, $match)){ $address = $match[3]; $quoted = AkActionMailerQuoting::quoteIfNecessary(trim($match[1],'\'"'), $charset); $phrase = str_replace('"','\"', $quoted); if($phrase[0] != '='){ return "\"$phrase\" <$address>"; }else{ return "$phrase <$address>"; } }else{ return $address; } }
public function getSubject($charset = null) { $charset = empty($charset) ? $this->getCharset() : $charset; return AkActionMailerQuoting::quoteIfNecessary($this->subject, $charset); }
function getSubject($charset = AK_ACTION_MAILER_DEFAULT_CHARSET) { return AkActionMailerQuoting::quoteIfNecessary($this->subject, $charset); }