Added transport class for MailOutput.
This commit is contained in:
@@ -98,7 +98,10 @@ class MailOutput extends GenericOutput
|
||||
$this->setHeadersFromString($headers);
|
||||
$recipients = implode(', ', $this->recipients);
|
||||
// TODO: Check if any recipients in the first place
|
||||
$mail_sent = mail($recipients, $this->subject, $mailbody, $this->getHeaders());
|
||||
return $mail_sent;
|
||||
$this->transport->setRecipients($recipients);
|
||||
$this->transport->setSubject($this->subject);
|
||||
$this->transport->setHeaders($this->getHeaders());
|
||||
$this->transport->setContent($mailbody);
|
||||
return $this->transport->send();
|
||||
}
|
||||
}
|
||||
|
||||
36
lib/Frs/Output/Transport/MailTransport.php
Normal file
36
lib/Frs/Output/Transport/MailTransport.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Frs\Output\Transport;
|
||||
|
||||
class MailTransport implements TransportInterface
|
||||
{
|
||||
private $recipients;
|
||||
private $subject;
|
||||
private $headers;
|
||||
private $content;
|
||||
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
public function setRecipients($recipients)
|
||||
{
|
||||
$this->recipients = $recipients;
|
||||
}
|
||||
|
||||
public function setSubject($subject)
|
||||
{
|
||||
$this->subject = $subject;
|
||||
}
|
||||
|
||||
public function setHeaders($headers)
|
||||
{
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
||||
public function transmit()
|
||||
{
|
||||
return mail($this->recipients, $this->subject, $this->content, $this->headers);
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,6 @@ class StdoutTransport implements TransportInterface
|
||||
public function transmit()
|
||||
{
|
||||
echo $this->content;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user