/** * E-mails the formatted text as attachment. * * @param string $formatedText */ public function write($formatedText) { $mail = new Mail(); $mail->addTo($this->to); $mail->setFrom($this->from); $mail->setSubject($this->subject); $mail->setBodyHtml(file_get_contents($this->emailTemplate)); $at = new Part($formatedText); $at->type = 'text/html'; $at->disposition = Mime::DISPOSITION_INLINE; $at->encoding = Mime::ENCODING_BASE64; $at->filename = $this->attachmentName; $at->description = 'LiveTest Attachment'; $mail->addAttachment($at); $mail->send(); }
private function writeMail($bodyText, $atText = null) { $mail = new Mail(); $mail->addTo($this->to); $mail->setFrom($this->from); $mail->setSubject($this->subject); $mail->setBodyHtml(file_get_contents($this->template) . $bodyText); if ($at !== null) { $at = new Part($atText); $at->type = 'text/html'; $at->disposition = Mime::DISPOSITION_INLINE; $at->encoding = Mime::ENCODING_BASE64; $at->filename = $this->attachmentName; $at->description = 'LiveTest Attachment'; $mail->addAttachment($at); } $mail->send(); }
public function testAutoMessageId() { $mail = new Mail\Mail(); $res = $mail->setBodyText('Message ID Test'); $mail->setFrom('*****@*****.**', 'test Mail User'); $mail->setSubject('Message ID Test'); $mail->setMessageId(); $mail->addTo('*****@*****.**'); $mock = new TransportMock(); $mail->send($mock); $this->assertTrue($mock->called); $this->assertTrue(isset($mock->headers['Message-Id'])); $this->assertTrue(isset($mock->headers['Message-Id'][0])); $this->assertTrue(strlen($mock->headers['Message-Id'][0]) > 0); }
protected function _prepareMail() { $mail = new Mail\Mail(); $mail->setBodyText('This is the text of the mail.'); $mail->setFrom('*****@*****.**', 'Alexander Steshenko'); $mail->addTo('*****@*****.**', 'Oleg Lobach'); $mail->setSubject('TestSubject'); return $mail; }