public function sendFrom($from = null, $delete = false)
{
$dir = null !== $from ? $from : getcwd();
$emailDir = new \Pop\File\Dir($dir, true);
$emailFiles = $emailDir->getFiles();
if (isset($emailFiles[0])) {
foreach ($emailFiles as $email) {
if (file_exists($email)) {
// Get the email data from the contents
$emailData = $this->getEmailFromFile($email);
// Send the email message.
mail($emailData['to'], $emailData['subject'], $emailData['message'], $emailData['headers'], $this->params);
// Delete the email file is the flag is passed
if ($delete) {
unlink($email);
}
}
}
}
return $this;
}