我正在尝试使用 sendemail 服务发送电子邮件;现在我想使用条件调用函数:
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);
}
但我收到消息错误:
加载资源失败:服务器响应状态为 500(内部服务器错误)
问候!
使用 swiftmailer 函数解决:https ://swiftmailer.symfony.com/docs/introduction.html