Skip to content

Commit

Permalink
fix bounce mail handling according to f3-factory/fatfree-core@3691611
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkez committed Apr 5, 2019
1 parent 50c13bd commit b9398ed
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
19 changes: 4 additions & 15 deletions mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* Christian Knuth <ikkez0n3@gmail.com>
* https://github.com/ikkez/F3-Sugar/
*
* @version 1.0.4
* @date: 12.02.2019
* @version 1.1.0
* @date: 05.04.2019
*/

class Mailer {
Expand Down Expand Up @@ -51,8 +51,6 @@ public function initSMTP() {
$f3->get('mailer.smtp.pw'));
if (!$f3->devoid('mailer.errors_to',$errors_to))
$this->setErrors($errors_to);
if (!$f3->devoid('mailer.return_to',$return_to))
$this->setReturn($return_to);
if (!$f3->devoid('mailer.reply_to',$reply_to))
$this->setReply($reply_to);
if (!$f3->devoid('mailer.from_mail',$from_mail)) {
Expand Down Expand Up @@ -144,21 +142,12 @@ public function setReply($email, $title=null) {
}

/**
* set Errors-to field
* set receipient for bounce error mails
* @param $email
* @param null $title
*/
public function setErrors($email, $title=null) {
$this->set('Errors-to', $this->buildMail($email,$title));
}

/**
* set Return-Path field
* @param $email
* @param null $title
*/
public function setReturn($email, $title=null) {
$this->set('Return-Path', $this->buildMail($email,$title));
$this->set('Sender', $this->buildMail($email,$title));
}

/**
Expand Down
8 changes: 5 additions & 3 deletions mailer_config.sample.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

[mailer]
; smtp config
smtp.host = smtp.domain.com
smtp.port = 25
smtp.user = username
Expand All @@ -10,9 +11,10 @@ smtp.scheme =
; global mail settings
from_mail = info@domain.de
from_name = Web Application
errors_to = error@domain.com
return_to = bounce@domain.com
reply_to = answer@domain.com
; mail to receive bounced mails
errors_to = bounce@domain.com
; used mail for replies to the sent mail
reply_to = support@domain.com

; handler for SMTP errors
on.failure = \MailTest::logError
Expand Down
13 changes: 9 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ smtp.pw = 123456789!
smtp.scheme =

; optional mail settings
from_mail = info@domain.com
from_mail = noreply@domain.com
from_name = Mario Bros.
errors_to = errors@domain.com
return_to = bounce@domain.com
reply_to = answer@domain.com
; mail to receive bounced mails
errors_to = bounce@domain.com
; used mail for replies to the sent mail
reply_to = info@domain.com

; handler for SMTP errors
on.failure = \Controller\Mail::logError
; handler for tracing opened mails
on.ping = \Controller\Mail::traceMail
; handler for redirecting jump links
on.jump = \Controller\Mail::traceClick
; automatically create jump links in all <a> tags
jumplinks = true
Expand Down

0 comments on commit b9398ed

Please sign in to comment.