i'm trying to sendemail using sendemail service; now i want to call the function using conditional:
function after_insert_mail($data)
{
global $h;
global $res;
global $mailin;
global $sendemail;
$now = 1;
function sendemail()
{
$mailin = new Mailin('main@mail.com', '***********************');
$mailin->addTo($email, $name)
->setFrom('fromemail@mail.com', 'From this email')
->setReplyTo('replyto@mail.com','Reply to')
->setSubject('Subject mail')
->setHtml('Email Body');
$res = $mailin->send();
}
do
{
sendemail();
} while ($now == 2);
}
But i get message error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Regards!
Resolved using swiftmailer function: https://swiftmailer.symfony.com/docs/introduction.html