Skip to content

Commit 3dd3bd7

Browse files
committed
#2 Make Backend for Emai
- Do not send mail if no recipient given
1 parent 7940111 commit 3dd3bd7

File tree

1 file changed

+17
-3
lines changed
  • app/code/community/LeMike/DevMode/Model/Core

1 file changed

+17
-3
lines changed

app/code/community/LeMike/DevMode/Model/Core/Email.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,39 @@
2525
* @license http://github.com/sourcerer-mike/mage_devMode/blob/master/License.md BSD 3-Clause ("BSD New")
2626
* @link http://github.com/sourcerer-mike/mage_devMode
2727
* @since $VERSION$
28+
*
29+
* @method string getToMail()
30+
* @method $this setToMail(string $mail)
2831
*/
2932
class LeMike_DevMode_Model_Core_Email extends Mage_Core_Model_Email
3033
{
34+
/**
35+
* Transfer mails in different ways.
36+
*
37+
* Mails will be:
38+
* - if lemike_devmode_core/email/recipient is empty the mail will be shown
39+
* otherwise send to lemike_devmode_core/email/recipient
40+
*
41+
* @return $this
42+
*/
3143
public function send()
3244
{
3345
$recipient = Mage::getStoreConfig('lemike_devmode_core/email/recipient');
3446

3547
if ($recipient)
36-
{
48+
{ // recipient is set: send mail to him
3749
LeMike_DevMode_Model_Log::info(
3850
'Reroute mail from "' . $this->getToMail() . '" to "' . $recipient . '".'
3951
);
4052
$this->setToEmail($recipient);
53+
54+
return parent::send();
4155
}
4256
else
43-
{
57+
{ // no receipient set: show content
4458
var_dump($this->getBody());
4559
}
4660

47-
return parent::send();
61+
return $this;
4862
}
4963
}

0 commit comments

Comments
 (0)