Пример #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;
}
Пример #2
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);
            }
        }
    }
}
Пример #3
0
 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";
     $header2 .= "Reply-To: " . $emailresponder . " \r\n";
     $header2 .= "CC: " . $emailhiddencopy . " \r\n";
     $header2 .= "MIME-Version: 1.0 \r\n";
     $header2 .= "Subject: Envío 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 border=\"0\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\">\n";
     $message .= "<tr>\n";
     $message .= "<td>\n";
     if ($_POST['HiddenFieldimagen'] != "") {
         $message .= "<div style=\"width: 400px; overflow: hidden; float: left; margin-bottom: 10px;\">\n";