/** * Simple HTML and attachment test */ public function testAltBodyAttachment() { $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.'; $this->Mail->AltBody = 'This is the text part of the email.'; $this->Mail->Subject .= ': AltBody + Attachment'; $this->Mail->isHTML(true); if (!$this->Mail->addAttachment(__FILE__, 'test_attach.txt')) { $this->assertTrue(false, $this->Mail->ErrorInfo); return; } $this->buildBody(); $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); if (is_writable('.')) { file_put_contents('message.txt', $this->Mail->createHeader() . $this->Mail->createBody()); } else { $this->assertTrue(false, 'Could not write local file - check permissions'); } }