Example #1
0
 public static function checkConnectivity($host, $port, $security, $username, $password)
 {
     $smtp = new self($host, $port, $security, 10);
     $username != '' && $smtp->auth($username, $password);
     $smtp->close();
 }
Example #2
0
 /**
     Shortcut to Send Quick Messages
     @param $host the XMPP Host to Connect to
     @param $user the username
     @param $pass the password
     @param $rcpt who to send to
     @param $body the message
     @return true
 */
 public static function sendMessage($host, $user, $pass, $rcpt, $body)
 {
     $arg = array('hostname' => $host, 'username' => $user, 'password' => $pass);
     $xmpp = new self($arg);
     $xmpp->auth();
     // $xmpp->presence('<presence type=\"available\" />');
     $xmpp->message($rcpt, $body);
 }
Example #3
0
 /**
 	Send using our Mail Server
 */
 static function send($host, $from, $rcpt, $mail)
 {
     $ret = array();
     if (is_string($host)) {
         // @todo parse as URI?
         $host['hostname'] = $host;
     }
     $smtp = new self($host['hostname']);
     if ($res = $smtp->ehlo()) {
         $ret = array_merge($ret, $res);
     }
     if (!empty($host['username'])) {
         if ($res = $smtp->auth($host['username'], $host['password'])) {
             $ret = array_merge($ret, $res);
         }
     }
     if ($res = $smtp->mailFrom($from)) {
         $ret = array_merge($ret, $res);
     }
     if ($res = $smtp->rcptTo($rcpt)) {
         $ret = array_merge($ret, $res);
     }
     if ($res = $smtp->data($mail)) {
         $ret = array_merge($ret, $res);
     }
     if ($res = $smtp->quit()) {
         $ret = array_merge($ret, $res);
     }
     return $ret;
 }