public static function encodeString($string, $encoding, $eol = "\n") {
		$encoding = strtolower($encoding);
		switch($encoding) {
			case self::ENCODING_BASE64:
				return chunk_split(base64_encode($string), 76, $eol);
			case self::ENCODING_7BIT:
			case self::ENCODING_8BIT:
				$encoded = self::cleanEol($string, $eol);
				if (substr($encoded, - (strlen($eol))) != $eol) $encoded .= $eol;
				return $encoded;
			case self::ENCODING_BINARY:
				return $string;
			case self::ENCODING_QUOTED_PRINTABLE:
				return quoted_printable_encode($string);
			default:
				throw new MailException('invalid encoding type');
		}
	}