Move conversion of mail header array into string to (PHP-)MailTransport.
This commit is contained in:
parent
9eef404735
commit
9c09108076
lib/Frs/Output
@ -57,20 +57,6 @@ class MailOutput extends GenericOutput
|
|||||||
$this->headers[$key] = $value;
|
$this->headers[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a header section (as string) of all currently set headers.
|
|
||||||
*
|
|
||||||
* @return string Header section.
|
|
||||||
*/
|
|
||||||
public function getHeaders()
|
|
||||||
{
|
|
||||||
$all_headers = '';
|
|
||||||
foreach ($this->headers as $key=>$value) {
|
|
||||||
$all_headers .= $key . ': ' . $value . "\r\n";
|
|
||||||
}
|
|
||||||
return $all_headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets mail headers. If headers contain a Subject: line, the subject is set from that.
|
* Sets mail headers. If headers contain a Subject: line, the subject is set from that.
|
||||||
*
|
*
|
||||||
@ -100,7 +86,7 @@ class MailOutput extends GenericOutput
|
|||||||
// TODO: Check if any recipients in the first place
|
// TODO: Check if any recipients in the first place
|
||||||
$this->transport->setRecipients($recipients);
|
$this->transport->setRecipients($recipients);
|
||||||
$this->transport->setSubject($this->subject);
|
$this->transport->setSubject($this->subject);
|
||||||
$this->transport->setHeaders($this->getHeaders());
|
$this->transport->setHeaders($this->headers);
|
||||||
$this->transport->setContent($mailbody);
|
$this->transport->setContent($mailbody);
|
||||||
return $this->transport->send();
|
return $this->transport->send();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,10 @@ class MailTransport implements TransportInterface
|
|||||||
|
|
||||||
public function setHeaders($headers)
|
public function setHeaders($headers)
|
||||||
{
|
{
|
||||||
$this->headers = $headers;
|
$this->headers = '';
|
||||||
|
foreach ($headers as $key=>$value) {
|
||||||
|
$this->headers .= $key . ': ' . $value . "\r\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transmit()
|
public function transmit()
|
||||||
|
Reference in New Issue
Block a user