public function testTo_Customized() { $mime = new \r8\Transform\MIME\Auto(); $mime->setLineLength(30); $mime->setHeader("name"); $mime->setOutputEncoding("UTF-8"); $mime->setInputEncoding("UTF-8"); $mime->setEOL("---"); $this->assertSame("name: A sample string that---\twraps to a new line", $mime->to("A sample string that wraps to a new line")); $this->assertSame("name: =?UTF-8?Q?A=09sample=09?=---\t=?UTF-8?Q?string_that_wraps?=", $mime->to("A\tsample\tstring that wraps")); $this->assertSame("name: =?UTF-8?B?CUEJc3RyaW5n?=---\t=?UTF-8?B?CQ==?=", $mime->to("\tA\tstring\t")); }
/** * Returns an the string of headers that will be sent with this message * * @param \r8\Mail $mail The piece of mail whose headers should be returned * @return String A MIME formatted header string */ public function getHeaderString(\r8\Mail $mail) { $mime = new \r8\Transform\MIME\Auto(); $mime->setEOL(self::EOL); $mime->setLineLength(self::LINE_LENGTH); $headers = $this->getHeaderList($mail); $result = array(); foreach ($headers as $name => $value) { $mime->setHeader($name); $result[] = $mime->to($value); } return implode(self::EOL, $result); }