/**
* @return bool
* @throws \Exception
*/
public function send()
{
// Simple cleanup
$this->_headers = Arr::clean($this->_headers);
$this->_atachments = Arr::clean($this->_atachments);
if ($this->_validateMode !== self::VALIDATE_NO_CHECK) {
if (!$this->_subject) {
$this->_error('Subject is empty');
}
if (!$this->_body) {
$this->_error('Body is empty');
}
if (count($this->_recipient) !== 2) {
$this->_error('Recipient is empty');
}
}
$result = false;
try {
if ($result = $this->_send()) {
$this->clean();
}
} catch (\Exception $e) {
$this->_error($e->getMessage());
}
return $result;
}