/** * @param Settings $settings * @param Account $account * @param WebMailMessage $message * @param string $from * @param string $to * @return bool */ function SendMail(&$settings, &$account, &$message, $from, $to) { if ($account->IsDemo) { $allRcpt = $message->GetAllRecipients(); for ($i = 0, $c = $allRcpt->Count(); $i < $c; $i++) { $rcpt =& $allRcpt->Get($i); if (strtolower($rcpt->GetDomain()) != 'afterlogic.com') { setGlobalError('For security reasons, sending e-mail from this account to external addresses is disabled. Please send to livedemo@afterlogic.com or relogin in Advanced Login mode using your mail account on another mail server.'); return false; } } } $log =& CLog::CreateInstance(); if ($from === null) { $fromAddr = $message->GetFrom(); $from = $fromAddr->Email; } if ($to === null) { $to = $message->GetAllRecipientsEmailsAsString(); } $link = null; $result = CSmtp::Connect($link, $account, $log); if ($result) { $result = CSmtp::Send($link, $account, $message, $from, $to, $log); if ($result) { $result = CSmtp::Disconnect($link, $log); } } else { setGlobalError(ErrorSMTPConnect); } return $result; }
/** * @param Account $account * @param WebMailMessage $message * @param string $from * @param string $to * @return bool */ function SendMail(&$account, &$message, $from, $to) { $link = null; $log =& CLog::CreateInstance(); $result = CSmtp::Connect($link, $account, $log); if ($result) { if ($from == null) { $fromAddr = $message->GetFrom(); $from = $fromAddr->Email; } if ($to == null) { $to = $message->GetAllRecipientsEmailsAsString(); } $result = CSmtp::Send($link, $account, $message, $from, $to, $log); if ($result) { $result = CSmtp::Disconnect($link, $log); } } else { setGlobalError(ErrorSMTPConnect); } return $result; }