Esempio n. 1
0
function enviarcorreo($datos)
{
    //$objResponse = new xajaxResponse();
    // Se incluye la librería necesaria para el envio
    require_once "fzo.mail.php";
    $prioridad = 3;
    $mail = new SMTP("localhost", '*****@*****.**', 'toyo694');
    // Se configuran los parametros necesarios para el envío
    $de = "*****@*****.**";
    $a = "*****@*****.**";
    $asunto = "Toyo Loba Import :: Formulario de Contactanos";
    //$cc = $_POST['cc'];
    //$bcc = $_POST['bcc'];
    $cuerpo = "Nombre: " . $datos['nombre'] . "<br>" . "Empresa: " . $datos['empresa'] . "<br>" . "Telefono: " . $datos['telefono'] . "<br>" . "Mensaje: " . $datos['mensaje'] . "<br><br><br><br><br>" . "Este es un correo automatico enviado desde la página de Toyo Loba Import, c.a.";
    $header = $mail->make_header($de, $a, $asunto, $prioridad, $cc, $bcc);
    /* Pueden definirse más encabezados. Tener en cuenta la terminación de la linea con (\r\n)
    	   $header .= "Reply-To: ".$_POST['from']." \r\n";
    	   $header .= "Content-Type: text/plain; charset=\"iso-8859-1\" \r\n";
    	   $header .= "Content-Transfer-Encoding: 8bit \r\n";
    	   $header .= "MIME-Version: 1.0 \r\n";
    	
    	   */
    // Se envia el correo y se verifica el error
    $error = $mail->smtp_send($de, $a, $header, $cuerpo, $cc, $bcc);
    if ($error == "0") {
        echo "E-mail enviado correctamente";
    } else {
        echo $error;
    }
    //return $objResponse;
}
Esempio n. 2
0
 /**
  * Return an instance of f3 \SMTP populated with application settings
  *
  * @param array $data
  * @return \SMTP
  */
 public static function &getMailer(array $data = []) : \SMTP
 {
     $f3 = \Base::instance();
     $smtp = new \SMTP($f3->get('email.host'), $f3->get('email.port'), $f3->get('email.scheme'), $f3->get('email.user'), $f3->get('email.pass'));
     $smtp->set('From', $f3->get('email.from'));
     // finally set other values like overrides
     foreach ($data as $k => $v) {
         $smtp->set($k, $v);
     }
     return $smtp;
 }
Esempio n. 3
0
function send_mail($name, $email, $ip, $is_spam, $message)
{
    $subject = '';
    if ($is_spam == false && empty($name) == false && empty($email) == false) {
        $subject = $GLOBALS['CONTACT_SUBJECT'];
        $smtp = new SMTP($GLOBALS['SMTP_SERVER'], $GLOBALS['SMTP_PORT']);
        $smtp->mail_from($email);
        return $smtp->send($GLOBALS['CONTACT_RECIPIENT'], $subject, "Name: " . $name . "\n\n" . stripslashes($message));
    } else {
        return true;
    }
}
 /**
  * 快捷发送一封邮件
  * @param string $to 收件人
  * @param string $sub 邮件主题
  * @param string $msg 邮件内容(HTML)
  * @param array $att 附件,每个键为文件名称,值为附件内容(可以为二进制文件),例如array('a.txt' => 'abcd' , 'b.png' => file_get_contents('x.png'))
  * @return bool 成功:true 失败:错误消息
  */
 public static function mail($to, $sub = '无主题', $msg = '无内容', $att = array())
 {
     if (defined("SAE_MYSQL_DB") && class_exists('SaeMail')) {
         $mail = new SaeMail();
         $options = array('from' => option::get('mail_name'), 'to' => $to, 'smtp_host' => option::get('mail_host'), 'smtp_port' => option::get('mail_port'), 'smtp_username' => option::get('mail_smtpname'), 'smtp_password' => option::get('mail_smtppw'), 'subject' => $sub, 'content' => $msg, 'content_type' => 'HTML');
         $mail->setOpt($options);
         $ret = $mail->send();
         if ($ret === false) {
             return 'Mail Send Error: #' . $mail->errno() . ' - ' . $mail->errmsg();
         } else {
             return true;
         }
     } else {
         $From = option::get('mail_name');
         if (option::get('mail_mode') == 'SMTP') {
             $Host = option::get('mail_host');
             $Port = intval(option::get('mail_port'));
             $SMTPAuth = (bool) option::get('mail_auth');
             $Username = option::get('mail_smtpname');
             $Password = option::get('mail_smtppw');
             $Nickname = option::get('mail_yourname');
             if (option::get('mail_ssl') == '1') {
                 $SSL = true;
             } else {
                 $SSL = false;
             }
             $mail = new SMTP($Host, $Port, $SMTPAuth, $Username, $Password, $SSL);
             $mail->att = $att;
             if ($mail->send($to, $From, $sub, $msg, $Nickname)) {
                 return true;
             } else {
                 return $mail->log;
             }
         } else {
             $name = option::get('mail_yourname');
             $mail = new PHPMailer();
             $mail->setFrom($From, $name);
             $mail->addAddress($to);
             $mail->Subject = $sub;
             $mail->msgHTML($msg);
             $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
             foreach ($att as $n => $d) {
                 $mail->addStringAttachment($d, "=?UTF-8?B?" . base64_encode($n) . "?=", 'base64', get_mime(get_extname($n)));
             }
             if (!$mail->send()) {
                 return $mail->ErrorInfo;
             } else {
                 return true;
             }
         }
     }
 }
Esempio n. 5
0
 public function checkSmtp()
 {
     //Create a new SMTP instance
     $smtp = new \SMTP();
     //Enable connection-level debug output
     $smtp->do_debug = \SMTP::DEBUG_CONNECTION;
     try {
         //Connect to an SMTP server
         if ($smtp->connect($this->getSmtpServer()->getSmtpHost(), $this->getSmtpServer()->getSmtpPort())) {
             //Say hello
             if ($smtp->hello($this->smtp->getSmtpHost())) {
                 //Put your host name in here
                 //Authenticate
                 dump($this->getSmtpServer()->getSmtpUsername());
                 dump($this->getSmtpServer()->getSmtpPassword());
                 if ($smtp->authenticate($this->getSmtpServer()->getSmtpUsername(), $this->getSmtpServer()->getSmtpPassword())) {
                     return true;
                 } else {
                     throw new \Exception('Authentication failed: ' . $smtp->getLastReply());
                 }
             } else {
                 throw new \Exception('HELO failed: ' . $smtp->getLastReply());
             }
         } else {
             throw new \Exception('Connect failed');
         }
     } catch (\Exception $e) {
         throw new \Exception('SMTP error: ' . $e->getMessage());
     }
     //Whatever happened, close the connection.
     $smtp->quit(true);
 }
Esempio n. 6
0
 /**
  * 快捷发送一封邮件
  * @param string $to 收件人
  * @param string $sub 邮件主题
  * @param string $msg 邮件内容(HTML)
  * @param array $att 附件,每个键为文件名称,值为附件内容(可以为二进制文件),例如array('a.txt' => 'abcd' , 'b.png' => file_get_contents('x.png'))
  * @return bool 成功:true 失败:错误消息
  */
 public static function mail($to, $sub = '无主题', $msg = '无内容', $att = array())
 {
     if (defined("SAE_MYSQL_DB") && class_exists('SaeMail')) {
         $mail = new SaeMail();
         $options = array('from' => option::get('mail_name'), 'to' => $to, 'smtp_host' => option::get('mail_host'), 'smtp_port' => option::get('mail_port'), 'smtp_username' => option::get('mail_smtpname'), 'smtp_password' => option::get('mail_smtppw'), 'subject' => $sub, 'content' => $msg, 'content_type' => 'HTML');
         $mail->setOpt($options);
         $ret = $mail->send();
         if ($ret === false) {
             return 'Mail Send Error: #' . $mail->errno() . ' - ' . $mail->errmsg();
         } else {
             return true;
         }
     } else {
         $From = option::get('mail_name');
         if (option::get('mail_mode') == 'SMTP') {
             $Host = option::get('mail_host');
             $Port = intval(option::get('mail_port'));
             $SMTPAuth = (bool) option::get('mail_auth');
             $Username = option::get('mail_smtpname');
             $Password = option::get('mail_smtppw');
             $Nickname = option::get('mail_yourname');
             if (option::get('mail_ssl') == '1') {
                 $SSL = true;
             } else {
                 $SSL = false;
             }
             $mail = new SMTP($Host, $Port, $SMTPAuth, $Username, $Password, $SSL);
             $mail->att = $att;
             if ($mail->send($to, $From, $sub, $msg, $Nickname)) {
                 return true;
             } else {
                 return $mail->log;
             }
         } else {
             $header = "MIME-Version:1.0\r\n";
             $header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
             $header .= "To: " . $to . "\r\n";
             $header .= "From: " . $From . "\r\n";
             $header .= "Subject: " . $sub . "\r\n";
             $header .= 'Reply-To: ' . $From . "\r\n";
             $header .= "Date: " . date("r") . "\r\n";
             $header .= "Content-Transfer-Encoding: base64\r\n";
             return mail($to, $sub, base64_encode($msg), $header);
         }
     }
 }
Esempio n. 7
0
 /**
  * Direct invocation of the constructor is not permitted.
  */
 protected function __construct(array $config)
 {
     $config['smtp_host'] = 'smtp.mandrillapp.com';
     $config['smtp_port'] = 465;
     $config['smtp_security'] = 'ssl';
     $config['smtp_user'] = $config['api_user'];
     $config['smtp_pass'] = $config['api_token'];
     parent::__construct($config);
 }
Esempio n. 8
0
 /**
  * Direct invocation of the constructor is not permitted.
  */
 protected function __construct(array $config)
 {
     $config['smtp_host'] = 'smtp.postmarkapp.com';
     $config['smtp_port'] = 587;
     $config['smtp_security'] = 'tls';
     $config['smtp_user'] = $config['api_token'];
     $config['smtp_pass'] = $config['api_token'];
     parent::__construct($config);
 }
Esempio n. 9
0
 /**
  * Direct invocation of the constructor is not permitted.
  */
 protected function __construct(array $config)
 {
     $config['smtp_host'] = 'smtp.sendgrid.net';
     $config['smtp_port'] = 465;
     $config['smtp_security'] = 'ssl';
     $config['smtp_user'] = $config['api_user'];
     $config['smtp_pass'] = $config['api_pass'];
     parent::__construct($config);
 }
Esempio n. 10
0
 public function __construct()
 {
     $host = Controller::getEnvironmentData('SMTP_HOST');
     $port = Controller::getEnvironmentData('SMTP_PORT');
     $scheme = Controller::getEnvironmentData('SMTP_SCHEME');
     $user = Controller::getEnvironmentData('SMTP_USER');
     $pw = Controller::getEnvironmentData('SMTP_PASS');
     parent::__construct($host, $port, $scheme, $user, $pw);
     // error handling
     $this->set('Errors-to', '' . Controller::getEnvironmentData('SMTP_ERROR') . '>');
     $this->set('MIME-Version', '1.0');
     $this->set('Content-Type', 'text/html; charset=ISO-8859-1');
 }
Esempio n. 11
0
function send_mail($to_address, $from, $subj, $messg)
{
    $smtp = new SMTP('mail.asahi-net.or.jp');
    $msg = new Message();
    $to = omitNickNameFromMailAddress($to_address);
    $subject = mb_encode_mimeheader($subj, "JIS", "auto");
    $message = mb_convert_encoding($messg, "JIS", "auto");
    /***** Headers ***/
    $headers = "";
    $headers .= "From: " . $from . "\r\n";
    /*
        if ($cc){
          $CC = omitNickNameFromMailAddress($cc);
          $headers .= "Cc: $CC \r\n";
        }
        if ($bcc)
          $BCC = omitNickNameFromMailAddress($bcc);
    */
    $msg->createHeader($subject, $from, $to, $CC, $BCC);
    $msg->createContent($message);
    $ack = $smtp->sendMessage($msg->header, $msg->getMailBody());
    return $ack;
}
Esempio n. 12
0
 /**
  * adapter for SMTP
  *
  * @param string $subject
  * @param string $content
  * @param email  $receiver
  *
  * @return string done or error message
  */
 static function sendmail($subject, $content, $receiver)
 {
     $to_address = $receiver == "" ? f3()->get('inquiry_receiver') : $receiver;
     $smtp = new \SMTP(f3()->get('smtp_host'), f3()->get('smtp_port'), 'SSL', f3()->get('smtp_account'), f3()->get('smtp_password'));
     $smtp->set('From', '"' . f3()->get('smtp_name') . '" <' . f3()->get('smtp_account') . '>');
     $smtp->set('To', '<' . $to_address . '>');
     $smtp->set('Subject', $subject);
     $smtp->set('Errors-to', '<' . f3()->get('smtp_account') . '>');
     $smtp->set('Content-Type', 'text/html');
     $sent = $smtp->send($content, TRUE);
     $mylog = $smtp->log();
     if ($sent) {
         return 'Done';
     } else {
         return $mylog;
     }
 }
Esempio n. 13
0
 public function ConfigSave()
 {
     global $sso_settings;
     $info = $this->GetInfo();
     $info["email_from"] = $_REQUEST["sso_email_two_factor_email_from"];
     $info["email_subject"] = trim($_REQUEST["sso_email_two_factor_email_subject"]);
     $info["email_msg"] = $_REQUEST["sso_email_two_factor_email_msg"];
     $info["email_msg_text"] = SMTP::ConvertHTMLToText($_REQUEST["sso_email_two_factor_email_msg"]);
     $info["window"] = (int) $_REQUEST["sso_email_two_factor_window"];
     $info["clock_drift"] = (int) $_REQUEST["sso_email_two_factor_clock_drift"];
     if (stripos($info["email_msg"], "@TWOFACTOR@") === false) {
         BB_SetPageMessage("error", "The E-mail Two-Factor Authentication 'E-mail Message' field does not contain '@TWOFACTOR@'.");
     } else {
         if ($info["window"] < 30 || $info["window"] > 300) {
             BB_SetPageMessage("error", "The E-mail Two-Factor Authentication 'Window Size' field contains an invalid value.");
         } else {
             if ($info["clock_drift"] < 0 || $info["clock_drift"] > $info["window"]) {
                 BB_SetPageMessage("error", "The E-mail Two-Factor Authentication 'Window Size' field contains an invalid value.");
             }
         }
     }
     $sso_settings["sso_login"]["modules"]["sso_email_two_factor"] = $info;
 }
Esempio n. 14
0
 /**
  * Sends mail via SMTP using PhpSMTP (Author:
  * Chris Ryan).  Returns bool.  Returns false if there is a
  * bad MAIL FROM, RCPT, or DATA input.
  * @private
  * @returns bool
  */
 function smtp_send($header, $body)
 {
     // Include SMTP class code, but not twice
     include_once $this->PluginDir . "class.smtp.php";
     $smtp = new SMTP();
     $smtp->do_debug = $this->SMTPDebug;
     // Try to connect to all SMTP servers
     $hosts = explode(";", $this->Host);
     $index = 0;
     $connection = false;
     $smtp_from = "";
     $bad_rcpt = array();
     $e = "";
     // Retry while there is no connection
     while ($index < count($hosts) && $connection == false) {
         if (strstr($hosts[$index], ":")) {
             list($host, $port) = explode(":", $hosts[$index]);
         } else {
             $host = $hosts[$index];
             $port = $this->Port;
         }
         if ($smtp->Connect($host, $port, $this->Timeout)) {
             $connection = true;
         }
         //printf("%s host could not connect<br>", $hosts[$index]); //debug only
         $index++;
     }
     if (!$connection) {
         $this->error_handler("SMTP Error: could not connect to SMTP host server(s)");
         return false;
     }
     // Must perform HELO before authentication
     $smtp->Hello($this->Helo);
     // If user requests SMTP authentication
     if ($this->SMTPAuth) {
         if (!$smtp->Authenticate($this->Username, $this->Password)) {
             $this->error_handler("SMTP Error: Could not authenticate");
             return false;
         }
     }
     if ($this->Sender == "") {
         $smtp_from = $this->From;
     } else {
         $smtp_from = $this->Sender;
     }
     if (!$smtp->Mail(sprintf("<%s>", $smtp_from))) {
         $e = sprintf("SMTP Error: From address [%s] failed", $smtp_from);
         $this->error_handler($e);
         return false;
     }
     // Attempt to send attach all recipients
     for ($i = 0; $i < count($this->to); $i++) {
         if (!$smtp->Recipient(sprintf("<%s>", $this->to[$i][0]))) {
             $bad_rcpt[] = $this->to[$i][0];
         }
     }
     for ($i = 0; $i < count($this->cc); $i++) {
         if (!$smtp->Recipient(sprintf("<%s>", $this->cc[$i][0]))) {
             $bad_rcpt[] = $this->cc[$i][0];
         }
     }
     for ($i = 0; $i < count($this->bcc); $i++) {
         if (!$smtp->Recipient(sprintf("<%s>", $this->bcc[$i][0]))) {
             $bad_rcpt[] = $this->bcc[$i][0];
         }
     }
     // Create error message
     if (count($bad_rcpt) > 0) {
         for ($i = 0; $i < count($bad_rcpt); $i++) {
             if ($i != 0) {
                 $e .= ", ";
             }
             $e .= $bad_rcpt[$i];
         }
         $e = sprintf("SMTP Error: The following recipients failed [%s]", $e);
         $this->error_handler($e);
         return false;
     }
     if (!$smtp->Data(sprintf("%s%s", $header, $body))) {
         $this->error_handler("SMTP Error: Data not accepted");
         return false;
     }
     $smtp->Quit();
     return true;
 }
Esempio n. 15
0
    public function ProcessFrontend()
    {
        global $sso_provider, $sso_settings, $sso_target_url, $sso_header, $sso_footer, $sso_providers, $sso_selectors_url;
        require_once SSO_ROOT_PATH . "/" . SSO_PROVIDER_PATH . "/" . $sso_provider . "/facebook.php";
        $facebook = new SSO_FacebookSDK(array("appId" => $sso_settings["sso_facebook"]["app_id"], "secret" => $sso_settings["sso_facebook"]["app_secret"]));
        $id = $facebook->getUser();
        if ($id) {
            try {
                // Calculate the required fields.
                $fields = array("id" => true, "first_name" => true, "last_name" => true);
                foreach (self::$fieldmap as $key => $info) {
                    if ($sso_settings["sso_facebook"]["map_" . $key] != "" && !isset($info["pseudo"])) {
                        $fields[isset($info["parent"]) ? $info["parent"] : $key] = true;
                    }
                }
                $profile = $facebook->api("/me", "GET", array("fields" => implode(",", array_keys($fields))));
            } catch (FacebookApiException $e) {
                // Fall through here to go to the next step.
                $id = 0;
                $exceptionmessage = $e->getMessage();
            }
        }
        if (isset($_REQUEST["sso_facebook_action"]) && $_REQUEST["sso_facebook_action"] == "signin") {
            if ($id) {
                // Create a fake username based on available information.
                if ($sso_settings["sso_facebook"]["map_username"] != "") {
                    if (isset($profile["email"])) {
                        $profile["username"] = (string) @substr($profile["email"], 0, strpos($profile["email"], "@"));
                    } else {
                        if (isset($profile["first_name"]) && isset($profile["last_name"])) {
                            $profile["username"] = $profile["first_name"] . @substr($profile["last_name"], 0, 1);
                        } else {
                            if (isset($profile["name"])) {
                                $name = explode(" ", $name);
                                $profile["username"] = $name[0] . @substr($name[count($name) - 1], 0, 1);
                            } else {
                                $profile["username"] = (string) $id;
                            }
                        }
                    }
                    $profile["username"] = preg_replace('/\\s+/', "_", trim(preg_replace('/[^a-z0-9]/', " ", strtolower((string) $profile["username"]))));
                }
                // Check username blacklist.
                $message = "";
                if (isset($profile["username"])) {
                    $blacklist = explode("\n", str_replace("\r", "\n", $sso_settings["sso_facebook"]["username_blacklist"]));
                    foreach ($blacklist as $word) {
                        $word = trim($word);
                        if ($word != "" && stripos($profile["username"], $word) !== false) {
                            $message = BB_Translate("Username contains a blocked word.");
                            break;
                        }
                    }
                }
                // Check e-mail domain blacklist.
                if (isset($profile["email"])) {
                    define("CS_TRANSLATE_FUNC", "BB_Translate");
                    require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/smtp.php";
                    $email = SMTP::MakeValidEmailAddress($profile["email"]);
                    if (!$email["success"]) {
                        $message = BB_Translate("Invalid e-mail address.  %s", $email["error"]);
                    } else {
                        $domain = strtolower(substr($email["email"], strrpos($email["email"], "@") + 1));
                        $y = strlen($domain);
                        $baddomains = explode("\n", strtolower($sso_settings["sso_facebook"]["email_bad_domains"]));
                        foreach ($baddomains as $baddomain) {
                            $baddomain = trim($baddomain);
                            if ($baddomain != "") {
                                $y2 = strlen($baddomain);
                                if ($domain == $baddomain || $y < $y2 && substr($domain, $y - $y2 - 1, 1) == "." && substr($domain, $y - $y2) == $baddomain) {
                                    $message = BB_Translate("E-mail address is in a blacklisted domain.");
                                    break;
                                }
                            }
                        }
                    }
                }
                if ($message == "") {
                    // Fix birthday to be in international format YYYY-MM-DD.
                    if (isset($profile["birthday"])) {
                        $birthday = explode("/", $profile["birthday"]);
                        $year = array_pop($birthday);
                        array_unshift($birthday, $year);
                        $profile["birthday"] = implode("-", $birthday);
                    }
                    // Convert most profile fields into strings.
                    foreach ($profile as $key => $val) {
                        if (is_string($val)) {
                            continue;
                        }
                        if (is_bool($val)) {
                            $val = (string) (int) $val;
                        } else {
                            if (is_numeric($val)) {
                                $val = (string) $val;
                            } else {
                                if (is_object($val) && isset($val->id) && isset($val->name)) {
                                    $val = $val->name;
                                }
                            }
                        }
                        $profile[$key] = $val;
                    }
                    // Convert specialized fields into strings.
                    if (isset($profile["age_range"])) {
                        $profile["age_range"] = trim($item->min . "-" . $item->max);
                    }
                    if (isset($profile["education"])) {
                        $items = array();
                        foreach ($profile["education"] as $item) {
                            $items[] = trim($item->year . " " . $item->type . " " . $item->school->name);
                        }
                        $profile["education"] = implode("\n", $items);
                    }
                    if (isset($profile["work"])) {
                        $items = array();
                        foreach ($profile["work"] as $item) {
                            $items[] = trim($item->employer . ", " . $item->location . ", " . $item->position);
                        }
                        $profile["work"] = implode("\n", $items);
                    }
                    $mapinfo = array();
                    foreach (self::$fieldmap as $key => $info) {
                        $key2 = $sso_settings["sso_facebook"]["map_" . $key];
                        if ($key2 != "" && isset($profile[$key])) {
                            $mapinfo[$key2] = $profile[$key];
                        }
                    }
                    // Process specialized fields.
                    if (isset($profile["birthday"])) {
                        $birthday = explode("-", $profile["birthday"]);
                        $key = "birthday_year";
                        $key2 = $sso_settings["sso_facebook"]["map_" . $key];
                        if ($key2 != "") {
                            $mapinfo[$key2] = $birthday[0];
                        }
                        $key = "birthday_month";
                        $key2 = $sso_settings["sso_facebook"]["map_" . $key];
                        if ($key2 != "") {
                            $mapinfo[$key2] = $birthday[1];
                        }
                        $key = "birthday_day";
                        $key2 = $sso_settings["sso_facebook"]["map_" . $key];
                        if ($key2 != "") {
                            $mapinfo[$key2] = $birthday[2];
                        }
                    }
                    SSO_ActivateUser($profile["id"], serialize($profile), $mapinfo);
                    // Only falls through on account lockout or a fatal error.
                    $message = BB_Translate("User activation failed.");
                }
            } else {
                if (isset($_REQUEST["error"]) && $_REQUEST["error"] == "access_denied") {
                    $message = BB_Translate("The request to sign in with Facebook was denied.");
                } else {
                    if (isset($_REQUEST["error_description"])) {
                        $message = BB_Translate($_REQUEST["error_description"]);
                    } else {
                        $message = BB_Translate("An unknown error occurred.  %s", $exceptionmessage);
                    }
                }
            }
            $message = BB_Translate("Sign in failed.  %s", $message);
            echo $sso_header;
            SSO_OutputHeartbeat();
            ?>
<div class="sso_main_wrap">
<div class="sso_main_wrap_inner">
	<div class="sso_main_messages_wrap">
		<div class="sso_main_messages">
			<div class="sso_main_messageerror"><?php 
            echo htmlspecialchars($message);
            ?>
</div>
		</div>
	</div>

	<div class="sso_main_info"><a href="<?php 
            echo htmlspecialchars($sso_target_url);
            ?>
"><?php 
            echo htmlspecialchars(BB_Translate("Try again"));
            ?>
</a><?php 
            if (count($sso_providers) > 1) {
                ?>
 | <a href="<?php 
                echo htmlspecialchars($sso_selectors_url);
                ?>
"><?php 
                echo htmlspecialchars(BB_Translate("Select another sign in method"));
                ?>
</a><?php 
            }
            ?>
</div>
</div>
</div>
<?php 
            echo $sso_footer;
        } else {
            // Calculate the required scope.
            $scope = array();
            foreach (self::$fieldmap as $key => $info) {
                if ($info["extra"] != "" && $sso_settings["sso_facebook"]["map_" . $key] != "") {
                    $scope[$info["extra"]] = true;
                }
            }
            // Get the login redirection URL.
            $options = array("scope" => implode(",", array_keys($scope)), "redirect_uri" => BB_GetRequestHost() . $sso_target_url . "&sso_facebook_action=signin");
            $url = $facebook->getLoginUrl($options);
            SSO_ExternalRedirect($url);
        }
    }
Esempio n. 16
0
function send_email($goingto, $toname, $sbj, $messg)
{
    global $Config;
    define('DISPLAY_XPM4_ERRORS', true);
    // display XPM4 errors
    $core_em = $Config->get('site_email');
    // If email type "0" (SMTP)
    if ($Config->get('email_type') == 0) {
        require_once 'core/mail/SMTP.php';
        // path to 'SMTP.php' file from XPM4 package
        $f = '' . $core_em . '';
        // from mail address
        $t = '' . $goingto . '';
        // to mail address
        // standard mail message RFC2822
        $m = 'From: ' . $f . "\r\n" . 'To: ' . $t . "\r\n" . 'Subject: ' . $sbj . "\r\n" . 'Content-Type: text/plain' . "\r\n\r\n" . '' . $messg . '';
        $h = explode('@', $t);
        // get client hostname
        $c = SMTP::MXconnect($h[1]);
        // connect to SMTP server (direct) from MX hosts list
        $s = SMTP::Send($c, array($t), $m, $f);
        // send mail
        // print result
        if ($s) {
            output_message('success', 'Mail Sent!');
        } else {
            output_message('error', print_r($_RESULT));
        }
        SMTP::Disconnect($c);
        // disconnect
    } elseif ($Config->get('email_type') == 1) {
        require_once 'core/mail/MIME.php';
        // path to 'MIME.php' file from XPM4 package
        // compose message in MIME format
        $mess = MIME::compose($messg);
        // send mail
        $send = mail($goingto, $sbj, $mess['content'], 'From: ' . $core_em . '' . "\n" . $mess['header']);
        // print result
        echo $send ? output_message('success', 'Mail Sent!') : output_message('error', 'Error!');
    } elseif ($Config->get('email_type') == 2) {
        require_once 'core/mail/MAIL.php';
        // path to 'MAIL.php' file from XPM4 package
        $m = new MAIL();
        // initialize MAIL class
        $m->From($core_em);
        // set from address
        $m->AddTo($goingto);
        // add to address
        $m->Subject($sbj);
        // set subject
        $m->Html($messg);
        // set html message
        // connect to MTA server 'smtp.hostname.net' port '25' with authentication: 'username'/'password'
        if ($Config->get('email_use_secure') == 1) {
            $c = $m->Connect($Config->get('email_smtp_host'), $Config->get('email_smtp_port'), $Config->get('email_smtp_user'), $Config->get('email_smtp_pass'), $Config->get('email_smtp_secure')) or die(print_r($m->Result));
        } else {
            $c = $m->Connect($Config->get('email_smtp_host'), $Config->get('email_smtp_port'), $Config->get('email_smtp_user'), $Config->get('email_smtp_pass')) or die(print_r($m->Result));
        }
        // send mail relay using the '$c' resource connection
        echo $m->Send($c) ? output_message('success', 'Mail Sent!') : output_message('error', 'Error! Please check your config and make sure you inserted your MTA info correctly.');
        $m->Disconnect();
        // disconnect from server
        // print_r($m->History); // optional, for debugging
    }
}
Esempio n. 17
0
function sendemail()
{
    global $msg, $required;
    if (isset($_POST['ajax'])) {
        $ajax = $_POST['ajax'];
    } else {
        $ajax = false;
    }
    if (isset($_POST['action']) and $_POST['action'] == 'sendmail') {
        $body = BODY;
        $subject = SUBJECT;
        $post_data = array_map('stripslashes', $_POST);
        // print_r($post_data);
        // die;
        foreach ($required as $id_field) {
            if ($post_data[$id_field] == '' || is_null($post_data[$id_field])) {
                if ($ajax) {
                    end_ajax($msg['error']);
                } else {
                    redirect(ERROR_URL);
                }
            }
        }
        if (!is_email($post_data['email']) or $post_data['email'] == '') {
            if ($ajax) {
                end_ajax($msg['error']);
            } else {
                redirect(ERROR_URL);
            }
        }
        foreach ($post_data as $id => $var) {
            if ($id == 'message') {
                $var = nl2br($var);
            }
            $body = str_replace("%{$id}%", $var, $body);
        }
        $subject = str_replace("%messagetype%", $post_data['messagetype'], $subject);
        require_once "fzo.mail.php";
        $mail = new SMTP("localhost", "*****@*****.**", "Refrescola09");
        $headers = $mail->make_header(FROM_EMAIL, TO_EMAIL, $subject, 3, $cc, $bcc);
        $headers .= 'mime-version: 1.0' . "\r\n";
        $headers .= 'content-type: text/html; charset=utf-8' . "\r\n";
        $headers .= "Reply-To: " . $post_data['email'] . " \r\n";
        /* Pueden definirse más encabezados. Tener en cuenta la terminación de la linea con (\r\n) $header .= "Reply-To: ".$_POST['from']." \r\n"; $header .= "Content-Type: text/plain; charset=\"iso-8859-1\" \r\n"; $header .= "Content-Transfer-Encoding: 8bit \r\n"; $header .= "MIME-Version: 1.0 \r\n"; */
        $error = $mail->smtp_send(FROM_EMAIL, TO_EMAIL, $headers, $body, $cc, $bcc);
        // $sendmail = mail( TO_EMAIL, SUBJECT, $body, $headers );
        if ($error == "0") {
            if ($ajax) {
                end_ajax($msg['success']);
            } else {
                redirect(SUCCESS_URL);
            }
        } else {
            if ($ajax) {
                end_ajax($msg['not-sent']);
            } else {
                redirect(NOTSENT_URL);
            }
        }
    }
}
Esempio n. 18
0
// to mail address
$subj = 'Hello World!';
// mail subject
$text = 'Text version of message.';
// text/plain version of message
$html = '<b>HTML</b> version of <u>message</u>.';
// text/html version of message
// CONFIGURATION ------------------
// set text/plain version of message
$msg1 = MIME::message($text, 'text/plain');
// set text/html version of message
$msg2 = MIME::message($html, 'text/html');
// compose message in MIME format
$mess = MIME::compose($msg1, $msg2);
// standard mail message RFC2822
$body = 'From: ' . $from . "\r\n" . 'To: ' . $to . "\r\n" . 'Subject: ' . $subj . "\r\n" . $mess['header'] . "\r\n\r\n" . $mess['content'];
// get client hostname
$expl = explode('@', $to);
// connect to SMTP server (direct) from MX hosts list
$conn = SMTP::mxconnect($expl[1]) or die(print_r($_RESULT));
// send mail
$sent = SMTP::send($conn, array($to), $body, $from);
// print result
if ($sent) {
    echo 'Sent !';
} else {
    print_r($_RESULT);
}
// disconnect from SMTP server
SMTP::disconnect($conn);
<?php 
if ($_POST['HiddenFieldNombreInmobiliariaactual'] == "") {
    $nombreinmo = "Nombre inmobiliaria";
} else {
    $nombreinmo = $_POST['HiddenFieldNombreInmobiliariaactual'];
}
if ($_POST['HiddenFieldemailresponder'] == "") {
    $emailresponder = $_POST['HiddenFieldMailUsuario'];
} else {
    $emailresponder = $_POST['HiddenFieldemailresponder'];
}
if ($_POST['enviar'] == "1") {
    if ($_POST['destinatario'] != "") {
        require_once "fzo.mail.php";
        $mail = new SMTP("localhost", "*****@*****.**", "Pruebagrupoinci123");
        $de = "*****@*****.**";
        $a = $_POST['destinatario'];
        $cc = "";
        $bcc = "*****@*****.**";
        $header2 = "From: " . $nombreinmo . " <*****@*****.**> \r\n";
        $header2 .= "Reply-To: " . $emailresponder . " \r\n";
        $header2 .= "Return-path: " . $_POST['HiddenFieldMailUsuario'] . "  \r\n";
        $header2 .= "MIME-Version: 1.0 \r\n";
        $header2 .= "subject: Envio Ficha Propiedad " . $_POST['HiddenFielddireccion'] . " \r\n";
        $header2 .= "Content-type: text/html; charset=UTF-8\n" . "\r\n";
        $email = $_POST['HiddenFieldMailUsuario'];
        $message = "<body style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px\">\n";
        $message .= "<table>\n";
        $message .= "<tr>\n";
        $message .= "<td>\n";
Esempio n. 20
0
 function smtp_send($header, $body)
 {
     global $enable_debug;
     $smtp = new SMTP();
     $smtp->do_debug = $enable_debug;
     $hosts = explode(";", $this->Host);
     $index = 0;
     $connection = false;
     while ($index < count($hosts) && $connection == false) {
         if ($smtp->Connect($hosts[$index], $this->Port, $this->Timeout)) {
             $connection = true;
         }
         $index++;
     }
     if (!$connection) {
         $this->error_handler("SMTP Error: could not connect to SMTP host server(s)");
         return false;
     }
     if ($this->blUseAuthLogin) {
         if (!$smtp->AuthHello($this->Helo, $this->AuthUser, $this->AuthPass)) {
             $this->error_handler("SMTP Error: Invalid username/password");
             return false;
         }
     } else {
         $smtp->Hello($this->Helo);
     }
     $smtp->MailFrom(sprintf("<%s>", $this->From));
     for ($i = 0; $i < count($this->to); $i++) {
         if (!$smtp->Recipient(sprintf("<%s>", $this->to[$i][0]))) {
             $this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
             return false;
         }
     }
     for ($i = 0; $i < count($this->cc); $i++) {
         if (!$smtp->Recipient(sprintf("<%s>", $this->cc[$i][0]))) {
             $this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
             return false;
         }
     }
     for ($i = 0; $i < count($this->bcc); $i++) {
         if (!$smtp->Recipient(sprintf("<%s>", $this->bcc[$i][0]))) {
             $this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
             return false;
         }
     }
     if (!$smtp->Data(sprintf("%s%s", $header, $body))) {
         $this->error_handler("SMTP Error: Data not accepted");
         return false;
     }
     $smtp->Quit();
 }
Esempio n. 21
0
    $date_detail = $count_befores_row->day . ' 15:00:00';
    $count_before[$date_detail][$depart_name] = $count_befores_row->count;
}
$count = array_merge($count_current, $count_before);
$smtp_server = APF::get_instance()->get_config('smtp_server');
$smtp_port = APF::get_instance()->get_config('smtp_port');
$smtp_user = APF::get_instance()->get_config('smtp_user');
$smtp_pass = APF::get_instance()->get_config('smtp_pass');
$smtp_usermail = APF::get_instance()->get_config('smtp_usermail');
$smtp_emailto = '*****@*****.**';
$cc_to = 'dl-tech-haozu@anjuke.com,dl-tech-pd-aifang@anjuke.com,dl-tech-pdsec@anjuke.com,dl-tech-jpse@anjuke.com,ibug@anjuke.com';
$mail_subject = '[iBug]Daily Reporter' . ' - ' . $date;
$template = new Template();
$mail_body = $template->load_daily_reporter_html_template($count);
$mail_type = 'HTML';
$smtp = new SMTP($smtp_server, $smtp_port, true, $smtp_user, $smtp_pass);
$smtp->debug = true;
$smtp->set_from("IBug No-Reply", $smtp_usermail);
$flag = $smtp->sendmail($smtp_emailto, $smtp_usermail, $mail_subject, $mail_body, $mail_type, $cc_to);
echo date('c ') . "SMTP_SERVER: {$smtp_server} \n";
echo date('c ') . "SUBJECT: {$mail_subject} \n";
echo date('c ') . "FROM: {$smtp_usermail} \n";
echo date('c ') . "TO: {$smtp_emailto} \n";
echo date('c ') . "CC: {$cc_to} \n";
if ($flag) {
    echo date('c ') . "Send Reporter Successfully!\n";
} else {
    $filename = APF::get_instance()->get_config('mail_error_log');
    $content = "Sent Daily Reporter - " . $date . " error\n";
    if (is_writable($filename)) {
        if (!($handle = fopen($filename, 'a'))) {
Esempio n. 22
0
    } else {
        echo "OK.\n";
    }
}
if ($mass) {
    while (!$plproxy->val("SELECT COUNT(*) FROM messages(?) WHERE id = ?", $sender['uid'], $message_id)) {
        echo "Wait PGQ (10 seconds)...\n";
        sleep(10);
    }
    $res = $plproxy->query("SELECT * FROM messages_zeros_userdata(?, ?)", $sender['uid'], $message_id);
} else {
    $res = $master->query($sql);
}
echo "Send email messages\n";
$count = 0;
$smtp = new SMTP();
if (!$smtp->Connect()) {
    die("Don't connect to SMTP\n");
}
while ($user = pg_fetch_assoc($res)) {
    if (empty($user['email']) || !is_null($eSubscr) && substr($user['subscr'], $eSubscr, 1) == '0') {
        continue;
    }
    $smtp->recipient = $user['uname'] . " " . $user['usurname'] . " [" . $user['login'] . "] <" . $user['email'] . ">";
    $smtp->subject = preg_replace("/\\{\\{([-_A-Za-z0-9]+)\\}\\}/e", "\$user['\\1']", $eSubject);
    $smtp->message = preg_replace("/\\{\\{([-_A-Za-z0-9]+)\\}\\}/e", "\$user['\\1']", $eMessage);
    if ($count > 0 && $count % $printStatus == 0) {
        echo "Working... {$count} emails sended\n";
    }
    $smtp->SmtpMail('text/html');
    $count++;
 function checkSMTP($smtp_server, $smtp_port = 25, $username, $password, $auth_enabled = false, $tls_enabled = true)
 {
     require_once "libs/phpmailer/class.smtp.php";
     $smtp = new SMTP();
     $smtp->Connect($smtp_server, $smtp_port);
     if (!$smtp->Connected()) {
         return array("ERROR" => "Failed to connect to server", "SMTP_ERROR" => $smtp->getError());
     }
     if (!$smtp->Hello()) {
         return array("ERROR" => "Failed to send hello command", "SMTP_ERROR" => $smtp->getError());
     }
     if ($tls_enabled) {
         if (!$smtp->StartTLS()) {
             return array("ERROR" => "Failed to start TLS", "SMTP_ERROR" => $smtp->getError());
         }
     }
     if ($auth_enabled) {
         if (!$smtp->Authenticate($username, $password)) {
             $error = $smtp->getError();
             if (preg_match("/STARTTLS/", $error['smtp_msg'])) {
                 return array("ERROR" => "Authenticate Error, TLS must be activated", "SMTP_ERROR" => $smtp->getError());
             } else {
                 return array("ERROR" => "Authenticate not accepted from server", "SMTP_ERROR" => $smtp->getError());
             }
         }
     }
     return true;
 }
Esempio n. 24
0
 public static function ConvertHTMLToText($data)
 {
     // Strip everything outside 'body' tags.
     $pos = stripos($data, "<body");
     while ($pos !== false) {
         $pos2 = strpos($data, ">", $pos);
         if ($pos2 !== false) {
             $data = substr($data, $pos2 + 1);
         } else {
             $data = "";
         }
         $pos = stripos($data, "<body");
     }
     $pos = stripos($data, "</body>");
     if ($pos !== false) {
         $data = substr($data, 0, $pos);
     }
     // Use HTML Purifier to clean up the tags.
     $data = self::SMTP_HTMLPurify($data);
     // Replace newlines outside of 'pre' tags with spaces.
     $data2 = "";
     $lastpos = 0;
     $pos = strpos($data, "<pre");
     $pos2 = strpos($data, "</pre>");
     $pos3 = strpos($data, ">", $pos);
     while ($pos !== false && $pos2 !== false && $pos3 !== false && $pos3 < $pos2) {
         $data2 .= self::ReplaceNewlines(" ", substr($data, $lastpos, $pos3 + 1 - $lastpos));
         $data2 .= self::ReplaceNewlines("\n", substr($data, $pos3 + 1, $pos2 - $pos3 - 1));
         $data2 .= "</pre>";
         $lastpos = $pos2 + 6;
         $pos = strpos($data, "<pre", $lastpos);
         $pos2 = strpos($data, "</pre>", $lastpos);
         $pos3 = strpos($data, ">", $pos);
     }
     $data = $data2 . self::ReplaceNewlines(" ", substr($data, $lastpos));
     $data = trim($data);
     // Process the DOM to create consistent output.
     if (!class_exists("simple_html_dom")) {
         require_once str_replace("\\", "/", dirname(__FILE__)) . "/simple_html_dom.php";
     }
     if (self::$html === false) {
         self::$html = new simple_html_dom();
     }
     // Begin from the innermost tags to the top-level tags.
     $data = str_replace(array("&nbsp;", "&#160;", " "), array(" ", " ", " "), $data);
     $data = str_replace("&amp;", "&", $data);
     $data = str_replace("&quot;", "\"", $data);
     $boundary = "---" . self::MIME_RandomString(10) . "---";
     $h_boundary = $boundary . "h---";
     $ol_boundary_s = $boundary . "ol_s---";
     $ol_boundary_e = $boundary . "ol_e---";
     $ul_boundary_s = $boundary . "ul_s---";
     $ul_boundary_e = $boundary . "ul_e---";
     $li_boundary_s = $boundary . "li_s---";
     $li_boundary_e = $boundary . "li_e---";
     $pre_boundary = $boundary . "pre---";
     $bq_boundary_s = $boundary . "bq_s---";
     $bq_boundary_e = $boundary . "bq_e---";
     self::$html->load("<body>" . $data . "</body>");
     $body = self::$html->find("body", 0);
     $node = $body->first_child();
     while ($node) {
         while ($node->first_child()) {
             $node = $node->first_child();
         }
         switch ($node->tag) {
             case "br":
                 $node->outertext = "\n";
                 break;
             case "div":
             case "p":
             case "table":
             case "tr":
             case "td":
                 $str = trim($node->innertext);
                 if ($str != "") {
                     $node->outertext = "\n" . $str . "\n";
                 } else {
                     $node->outertext = " ";
                 }
                 break;
             case "strong":
             case "b":
                 $str = trim($node->innertext);
                 if ($str != "") {
                     $node->outertext = " *" . $str . "* ";
                 } else {
                     $node->outertext = " ";
                 }
                 break;
             case "th":
             case "h4":
             case "h5":
             case "h6":
                 $str = trim($node->innertext);
                 if ($str != "") {
                     $node->outertext = "\n*" . $str . "*\n";
                 } else {
                     $node->outertext = " ";
                 }
                 break;
             case "em":
             case "i":
                 $str = trim($node->innertext);
                 if ($str != "") {
                     $node->outertext = " _" . $str . "_ ";
                 } else {
                     $node->outertext = " ";
                 }
                 break;
             case "a":
                 $str = trim($node->innertext);
                 if ($str == "" || !isset($node->href)) {
                     $node->outertext = " ";
                 } else {
                     if ($str == $node->href) {
                         $node->outertext = "[ " . $node->href . " ]";
                     } else {
                         $node->outertext = $str . " (" . $node->href . ") ";
                     }
                 }
                 break;
             case "ul":
                 $node->outertext = "\n" . $ul_boundary_s . trim($node->innertext) . $ul_boundary_e . "\n";
                 break;
             case "ol":
                 $node->outertext = "\n" . $ol_boundary_s . trim($node->innertext) . $ol_boundary_e . "\n";
                 break;
             case "li":
                 $node->outertext = "\n" . $li_boundary_s . trim($node->innertext) . $li_boundary_e . "\n";
                 break;
             case "h1":
             case "h2":
             case "h3":
                 $str = strtoupper(trim($node->innertext));
                 if ($str != "") {
                     $node->outertext = $h_boundary . "\n*" . $str . "*\n";
                 } else {
                     $node->outertext = " ";
                 }
                 break;
             case "pre":
                 $node->outertext = "\n" . $pre_boundary . $node->innertext . $pre_boundary . "\n";
                 break;
             case "blockquote":
                 $node->outertext = "\n" . $bq_boundary_s . "----------\n" . trim($node->innertext) . "\n----------" . $bq_boundary_e . "\n";
                 break;
             case "img":
                 $src = $node->src;
                 $pos = strrpos($src, "/");
                 if ($pos !== false) {
                     $src = substr($src, $pos + 1);
                 }
                 if (isset($node->alt) && trim($node->alt) != "" && trim($node->alt) != $src) {
                     $node->outertext = trim($node->alt);
                 } else {
                     $node->outertext = " ";
                 }
                 break;
             default:
                 $node->outertext = " " . trim($node->innertext) . " ";
         }
         self::$html->load(self::$html->save());
         $body = self::$html->find("body", 0);
         $node = $body->first_child();
     }
     $body = self::$html->find("body", 0);
     $data = trim($body->innertext);
     // Post-scan the data for boundaries and alter whitespace accordingly.
     $data2 = "";
     $depth = array();
     $lastpos = 0;
     $pos = strpos($data, $boundary);
     while ($pos !== false) {
         $data2 .= self::ConvertHTMLToText_FixWhitespace(substr($data, $lastpos, $pos - $lastpos), $depth);
         $pos2 = strpos($data, "---", $pos + 16);
         $str = substr($data, $pos + 16, $pos2 - $pos - 16);
         $lastpos = $pos2 + 3;
         switch ($str) {
             case "ol_s":
                 $depth[] = array("ol", 1);
                 break;
             case "ol_e":
                 array_pop($depth);
                 if (!count($depth)) {
                     $data2 .= "\n";
                 }
                 break;
             case "ul_s":
                 $depth[] = array("ul");
                 break;
             case "ul_e":
                 array_pop($depth);
                 if (!count($depth)) {
                     $data2 .= "\n";
                 }
                 break;
             case "li_s":
                 $depth[] = array("li", false);
                 break;
             case "li_e":
                 array_pop($depth);
                 break;
             case "pre":
                 $pos2 = strpos($data, $pre_boundary, $lastpos);
                 $data2 .= substr($data, $lastpos, $pos2 - $lastpos);
                 $lastpos = $pos2 + strlen($pre_boundary);
                 break;
             case "bq_s":
                 $depth[] = array("bq");
                 break;
             case "bq_e":
                 array_pop($depth);
                 if (!count($depth)) {
                     $data2 .= "\n";
                 }
                 break;
         }
         $pos = strpos($data, $boundary, $lastpos);
     }
     $data = $data2 . self::ConvertHTMLToText_FixWhitespace(substr($data, $lastpos), $depth);
     return $data;
 }
Esempio n. 25
0
     if (!($up = move_uploaded_file($_FILES['file_up']['tmp_name'], $file_dir . $_FILES['file_up']['name'])) || !is_file($file_dir . $_FILES['file_up']['name'])) {
         echo '<div style="color:#FF0000;">The file can&#39; t be upload !</div>';
     }
     // On défine where is the file
     $file_up = $file_dir . $_FILES['file_up']['name'];
 } else {
     // We say that we have uploaded the file
     $up = 1;
     $file_up = 0;
 }
 // We check we have uploaded the file
 if ($up && $no_empty_champs) {
     // We include the SMTP class
     include './Class.SMTP.php';
     // We define the parametres of the SMTP connection
     $smtp = new SMTP($smtp_serveur, $smtp_login, $smtp_passe, 25, $smtp_domain);
     // We int the sender
     $smtp->set_from($_POST['name'], $_POST['email']);
     if ($file_up) {
         // Attach file
         $smtp->add_file($file_up);
     }
     // We define the Content type ( Value can be: html (for html), txt (for text), txt/html (for text and html) )
     $smtp->ContentType = 'txt';
     // We send the mail
     $smtp->smtp_mail($mail_to, $_POST['sujet'], $_POST['msg']);
     // We check that the mail as been send
     if (!$smtp->erreur) {
         echo '<div style="text-align:center; color:#008000;">Your mail as been send.</div>', "\r\n";
         if ($file_up) {
             // Delete tempory file
Esempio n. 26
0
 function smtp_send($header, $body)
 {
     include "smtp.inc.php";
     // Load code only if asked
     $smtp = new SMTP();
     $smtp->do_debug = $this->SMTPDebug;
     // Try to connect to all SMTP servers
     $hosts = explode(";", $this->Host);
     $x = 0;
     $connection = false;
     while ($x < count($hosts)) {
         if ($smtp->Connect($hosts[$x], $this->Port, $this->Timeout)) {
             $connection = true;
             break;
         }
         // printf("%s host could not connect<br>", $hosts[$x]); //debug only
         $x++;
     }
     if (!$connection) {
         $this->error_handler("SMTP Error: could not connect to SMTP host server(s)");
     }
     $smtp->Hello($this->Helo);
     $smtp->Mail(sprintf("<%s>", $this->From));
     for ($x = 0; $x < count($this->to); $x++) {
         $smtp->Recipient(sprintf("<%s>", $this->to[$x][0]));
     }
     for ($x = 0; $x < count($this->cc); $x++) {
         $smtp->Recipient(sprintf("<%s>", $this->cc[$x][0]));
     }
     for ($x = 0; $x < count($this->bcc); $x++) {
         $smtp->Recipient(sprintf("<%s>", $this->bcc[$x][0]));
     }
     $smtp->Data(sprintf("%s%s", $header, $body));
     $smtp->Quit();
 }
Esempio n. 27
0
 private function SignupUpdateCheck(&$result, $ajax, $update, $admin)
 {
     $data = @json_decode(@file_get_contents(SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/sms_mms_gateways.txt"));
     if (is_object($data)) {
         $field = $admin ? BB_GetValue("sso_login_sms_recovery_phone", false) : SSO_FrontendFieldValue($update ? "sso_login_sms_recovery_phone_update" : "sso_login_sms_recovery_phone");
         $field2 = $admin ? BB_GetValue("sso_login_sms_recovery_carrier", false) : SSO_FrontendFieldValue($update ? "sso_login_sms_recovery_carrier_update" : "sso_login_sms_recovery_carrier");
         if (!$ajax || $field !== false) {
             $info = $this->GetInfo();
             if ($field === false || $field == "") {
                 if ($ajax && $field2 !== false && $field2 != "") {
                     $result["errors"][] = BB_Translate($admin ? "Fill in the user's mobile phone number." : "Fill in your mobile phone number.");
                 }
             } else {
                 $phone = preg_replace("/[^0-9]/", "", $field);
                 if (strlen($phone) < 9) {
                     $result["warnings"][] = BB_Translate("Phone numbers are typically longer.  Format is usually trunk/country code + area/region code + local number.");
                 } else {
                     if (strlen($phone) > 15) {
                         $result["warnings"][] = BB_Translate("Phone numbers are typically shorter.  Format is usually trunk/country code + area/region code + local number.");
                     }
                 }
                 if (!$ajax || $field2 !== false) {
                     if ($field2 === false || $field2 == "") {
                         if ($ajax) {
                             $result["errors"][] = BB_Translate($admin ? "Select the user's mobile phone carrier." : "Select your mobile phone carrier.");
                         }
                     } else {
                         $field2 = explode("-", $field2);
                         if (count($field2) != 2) {
                             $result["errors"][] = BB_Translate($admin ? "Select the user's mobile phone carrier." : "Select your mobile phone carrier.");
                         } else {
                             $country = $field2[0];
                             $carrier = $field2[1];
                             if (!isset($data->sms_carriers->{$country}) || !isset($data->sms_carriers->{$country}->{$carrier})) {
                                 $result["errors"][] = BB_Translate($admin ? "Select the user's mobile phone carrier." : "Select your mobile phone carrier.");
                             } else {
                                 $item = $data->sms_carriers->{$country}->{$carrier};
                                 $emailaddr = str_replace("{number}", $field, $item[1]);
                                 if (!class_exists("SMTP")) {
                                     define("CS_TRANSLATE_FUNC", "BB_Translate");
                                     require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/smtp.php";
                                 }
                                 $email = SMTP::MakeValidEmailAddress($emailaddr);
                                 if (!$email["success"]) {
                                     $result["errors"][] = BB_Translate("Invalid e-mail address.  %s", $email["error"]);
                                 } else {
                                     if ($email["email"] != trim($emailaddr)) {
                                         $result["warnings"][] = BB_Translate("Invalid e-mail address.  Perhaps you meant '%s' instead?", $email["email"]);
                                     }
                                     $result["htmlsuccess"] = BB_Translate("Mobile phone information looks okay.  SMS messages will be sent via the e-mail address '%s'.", "<a href=\"mailto:" . htmlspecialchars($emailaddr) . "\">" . htmlspecialchars($emailaddr) . "</a>");
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 28
0
if ($_POST['HiddenFieldFlagTerreno'] == "1") {
    $labelIfTerrenoSupTotal = "Superficie Total: ";
    $labelIfTerreno = "Superficie Cubierta: ";
    $datos_catastrales = explode("-", $_POST['HiddenFieldpiso']);
    $seccionNum = $datos_catastrales[0];
    $manzanaNum = $datos_catastrales[1];
    $graficoNum = $datos_catastrales[2];
    $subdivisionNum = $datos_catastrales[3];
} else {
    $labelIfTerrenoSupTotal = "Metros cuadrados Cubiertos: ";
    $labelIfTerreno = "Metros Cuadrados Semicubiertos: ";
}
if ($_POST['enviar'] == "1") {
    if ($_POST['destinatario'] != "") {
        require_once "fzo.mail.php";
        $mail = new SMTP("localhost", "", "");
        $de = "*****@*****.**";
        $a = $_POST['destinatario'];
        $asunto = "Envío Ficha Propiedad " . $_POST['HiddenFielddireccion'];
        $cc = $emailhiddencopy;
        $bcc = $_POST['bcc'];
        //$header2 .= "Reply-To: ".$emailresponder." \r\n";
        //$header2 .= "Return-path: ".$_POST['HiddenFieldMailUsuario']."  \r\n";
        //$header2 .= "MIME-Version: 1.0 \r\n";
        //$header2 .= "subject: Envio Ficha Propiedad ".$_POST['HiddenFielddireccion']." \r\n";
        //$header2 .= "Content-type: text/html; charset=UTF-8\n" . "\r\n";
        //
        //////////////////////////////////////////////////////
        $header2 = $mail->make_header($de, $a, $asunto, $_POST['prioridad'], $cc, $bcc);
        //$header2 = "From: ".$nombreinmo." <".$emailresponder."> \r\n";
        $header2 = "From: " . $nombreinmo . " <" . $de . "> \r\n";
Esempio n. 29
0
 /**
  * Add an error message to the error container.
  * @access protected
  * @param string $msg
  * @return void
  */
 protected function setError($msg)
 {
     $this->error_count++;
     if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
         $lasterror = $this->smtp->getError();
         if (!empty($lasterror['error'])) {
             $msg .= $this->lang('smtp_error') . $lasterror['error'];
             if (!empty($lasterror['detail'])) {
                 $msg .= ' Detail: ' . $lasterror['detail'];
             }
             if (!empty($lasterror['smtp_code'])) {
                 $msg .= ' SMTP code: ' . $lasterror['smtp_code'];
             }
             if (!empty($lasterror['smtp_code_ex'])) {
                 $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex'];
             }
         }
     }
     $this->ErrorInfo = $msg;
 }
Esempio n. 30
0
 public function sendMail($assunto, $mensagem, $email_para = null)
 {
     $dados_envio = $this->configuracoesGerais(array('email_destinatario', 'email_remetente_host', 'email_remetente', 'email_remetente_senha'));
     //DADOS SMTP
     if (!empty($dados_envio)) {
         $smtp = $dados_envio['Configuracao']['email_remetente_host'];
         $usuario = $dados_envio['Configuracao']['email_remetente'];
         $senha = $dados_envio['Configuracao']['email_remetente_senha'];
         if ($email_para == null) {
             $email_para = $dados_envio['Configuracao']['email_destinatario'];
         }
     } else {
         $smtp = "smtp.zoio.net.br";
         $usuario = "*****@*****.**";
         $senha = "zoio2010";
         if ($email_para == null) {
             $email_para = '*****@*****.**';
         }
     }
     $email_de = $usuario;
     require_once './smtp/smtp.php';
     $mail = new SMTP();
     $mail->Delivery('relay');
     $mail->Relay($smtp, $usuario, $senha, 587, 'login', false);
     //$mail->addheader('content-type', 'text/html; charset=utf-8');
     //$mail->addheader('content-type', 'text/html; charset=iso-8859-1');
     $mail->TimeOut(10);
     $mail->Priority('normal');
     $mail->From($email_de);
     $mail->AddTo($email_para);
     //$mail->AddBcc('*****@*****.**');
     $mail->Html($mensagem);
     if ($mail->Send($assunto)) {
         //echo '_SMTP+_Enviou para g......@zoio.net.br';
         return true;
     } else {
         //echo '_SMTP+_Não enviou e-mail';
         return false;
     }
 }