Added the capability to use a debug email address for receiving all the

sent emails
This commit is contained in:
bison-paolo
2016-10-12 16:53:45 +02:00
parent ccb9daffaa
commit 4ace90adc7
3 changed files with 44 additions and 19 deletions
+25 -1
View File
@@ -54,7 +54,16 @@ class MailLib
}
$this->ci->email->from($from, $alias);
$this->ci->email->to($to);
// Check if the email address of the debug recipient is a valid one
$recipient = $to;
if ($this->validateEmailAddress(MAIL_DEBUG))
{
// if is it valid use it!!!
$recipient = MAIL_DEBUG;
}
$this->ci->email->to($recipient);
if (!is_null($cc)) $this->ci->email->cc($cc);
if (!is_null($bcc)) $this->ci->email->bcc($bcc);
$this->ci->email->subject($subject);
@@ -115,6 +124,21 @@ class MailLib
return $cfg;
}
/**
* Validates an email address
*/
public function validateEmailAddress($emailAddress)
{
$valid = false;
if (!empty($emailAddress))
{
$valid = filter_var($emailAddress, FILTER_VALIDATE_EMAIL);
}
return $valid;
}
/**
* Checks if it has to wait until the sending of the next
*/