public function send()
{
if (c::get('email.disabled')) {
return array('status' => 'error', 'msg' => l::get('email.disabled', 'Email has been disabled'));
}
if (!v::email($this->extractAddress($this->options['from']))) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.sender', 'Invalid sender'));
}
if (!v::email($this->extractAddress($this->options['to']))) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.recipient', 'Invalid recipient'));
}
if (!v::email($this->extractAddress($this->options['replyto']))) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.replyto', 'Invalid Reply-To Address'));
}
if (str::length($this->options['subject']) == 0) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.subject', 'The subject is missing'));
}
$method = 'sendWith' . str::ucfirst($this->options['use']);
if (!method_exists(__CLASS__, $method)) {
return array('status' => 'error', 'msg' => l::get('email.error.invalid.mailer', 'This email service is not supported'));
}
return $this->{$method}();
}