static function sendemail($to, $subject, $message2, $ar = array()) { include WRA_Path . '/modules/swiftmailer/swift_required.php'; WRA::debug($to); // die(); if (!Swift_Validate::email($to)) { //if email is not valid //do something, skip them or log them WRA::debug("invalid email"); WRA::debug($to); die; } $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(WRA_CONF::$smtpfrom)->setTo(array($to))->setBody($message2, 'text/html', 'utf-8'); for ($i = 0; $i < count($ar); $i++) { } $transporter = Swift_SmtpTransport::newInstance(WRA_CONF::$smtpserver, WRA_CONF::$smtpport, '')->setUsername(WRA_CONF::$smtpuser)->setPassword(WRA_CONF::$smtppassword); $mailer = Swift_Mailer::newInstance($transporter); try { $result = $mailer->send($message); } catch (Exception $e) { WRA::logit($e->getMessage(), 'message'); // echo $e->getMessage(), "\n"; } return $result; }
static function sendemail($to, $subject, $message2, $ar = array()) { include WRA_Path . '/modules/swiftmailer/swift_required.php'; $message = Swift_Message::newInstance()->setFrom(WRA_CONF::$smtpfrom)->setTo(array($to))->setSubject($subject)->setBody($message2, 'text/html', 'utf-8'); for ($i = 0; $i < count($ar); $i++) { // $message->attach(Swift_Attachment::fromPath(WRA_Path.'/'.$ar[$i])); } $transporter = Swift_SmtpTransport::newInstance(WRA_CONF::$smtpserver, WRA_CONF::$smtpport, '')->setUsername(WRA_CONF::$smtpuser)->setPassword(WRA_CONF::$smtppassword); $mailer = Swift_Mailer::newInstance($transporter); try { $result = $mailer->send($message); } catch (Exception $e) { WRA::logit($e->getMessage(), 'message'); // echo $e->getMessage(), "\n"; } return $result; }