summaryrefslogtreecommitdiff
path: root/app/Core/Mail/Transport
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-18 19:13:08 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-18 19:13:08 -0500
commitbd0ed331797717ff9db63216df550d95674ba248 (patch)
tree0f3fbe140b26274ab5ac80b74aa7a29d37b0689b /app/Core/Mail/Transport
parentb4dc602381a367ce9ed1a1bbe28b7903976fdabe (diff)
Add Reply-To header to emails sent from Kanboard
Diffstat (limited to 'app/Core/Mail/Transport')
-rw-r--r--app/Core/Mail/Transport/Mail.php28
-rw-r--r--app/Core/Mail/Transport/Sendmail.php4
-rw-r--r--app/Core/Mail/Transport/Smtp.php8
3 files changed, 23 insertions, 17 deletions
diff --git a/app/Core/Mail/Transport/Mail.php b/app/Core/Mail/Transport/Mail.php
index c99cc8ba..0d819f77 100644
--- a/app/Core/Mail/Transport/Mail.php
+++ b/app/Core/Mail/Transport/Mail.php
@@ -12,7 +12,7 @@ use Kanboard\Core\Mail\ClientInterface;
/**
* PHP Mail Handler
*
- * @package transport
+ * @package Kanboard\Core\Mail\Transport
* @author Frederic Guillot
*/
class Mail extends Base implements ClientInterface
@@ -21,20 +21,26 @@ class Mail extends Base implements ClientInterface
* Send a HTML email
*
* @access public
- * @param string $email
- * @param string $name
- * @param string $subject
- * @param string $html
- * @param string $author
+ * @param string $recipientEmail
+ * @param string $recipientName
+ * @param string $subject
+ * @param string $html
+ * @param string $authorName
+ * @param string $authorEmail
*/
- public function sendEmail($email, $name, $subject, $html, $author)
+ public function sendEmail($recipientEmail, $recipientName, $subject, $html, $authorName, $authorEmail = '')
{
try {
$message = Swift_Message::newInstance()
->setSubject($subject)
- ->setFrom(array($this->helper->mail->getMailSenderAddress() => $author))
- ->setTo(array($email => $name))
- ->setBody($html, 'text/html');
+ ->setFrom($this->helper->mail->getMailSenderAddress(), $authorName)
+ ->setTo(array($recipientEmail => $recipientName));
+
+ if (! empty($authorEmail)) {
+ $message->setReplyTo($authorEmail);
+ }
+
+ $message->setBody($html, 'text/html');
Swift_Mailer::newInstance($this->getTransport())->send($message);
} catch (Swift_TransportException $e) {
@@ -46,7 +52,7 @@ class Mail extends Base implements ClientInterface
* Get SwiftMailer transport
*
* @access protected
- * @return \Swift_Transport|\Swift_MailTransport|\Swift_SmtpTransport|\Swift_SendmailTransport
+ * @return \Swift_Transport
*/
protected function getTransport()
{
diff --git a/app/Core/Mail/Transport/Sendmail.php b/app/Core/Mail/Transport/Sendmail.php
index 039be705..a1a2cbd6 100644
--- a/app/Core/Mail/Transport/Sendmail.php
+++ b/app/Core/Mail/Transport/Sendmail.php
@@ -7,7 +7,7 @@ use Swift_SendmailTransport;
/**
* PHP Mail Handler
*
- * @package transport
+ * @package Kanboard\Core\Mail\Transport
* @author Frederic Guillot
*/
class Sendmail extends Mail
@@ -16,7 +16,7 @@ class Sendmail extends Mail
* Get SwiftMailer transport
*
* @access protected
- * @return \Swift_Transport|\Swift_MailTransport|\Swift_SmtpTransport|\Swift_SendmailTransport
+ * @return \Swift_Transport
*/
protected function getTransport()
{
diff --git a/app/Core/Mail/Transport/Smtp.php b/app/Core/Mail/Transport/Smtp.php
index 815dde5d..7338a81e 100644
--- a/app/Core/Mail/Transport/Smtp.php
+++ b/app/Core/Mail/Transport/Smtp.php
@@ -7,7 +7,7 @@ use Swift_SmtpTransport;
/**
* PHP Mail Handler
*
- * @package transport
+ * @package Kanboard\Core\Mail\Transport
* @author Frederic Guillot
*/
class Smtp extends Mail
@@ -16,7 +16,7 @@ class Smtp extends Mail
* Get SwiftMailer transport
*
* @access protected
- * @return \Swift_Transport|\Swift_MailTransport|\Swift_SmtpTransport|\Swift_SendmailTransport
+ * @return \Swift_Transport
*/
protected function getTransport()
{
@@ -29,8 +29,8 @@ class Smtp extends Mail
$transport->setStreamOptions(array(
'ssl' => array(
'allow_self_signed' => true,
- 'verify_peer' => false,
- 'verify_peer_name' => false,
+ 'verify_peer' => false,
+ 'verify_peer_name' => false,
)
));
}