Clicky

Hospedado por Limestone Networks

Jump to content
  • Sign Up

Sign in to follow this  
DeboraFernando

Ajuda sendmail.php

Recommended Posts

Olá não to conseguindo envia email com o arquivo sendmail.php

 

podem me ajuda ? 

 

oque eu coloquei de errado ?

 

<?php



    $site_owners_email = 'xatfernando@hotmail.com'; // Replace this with your own email address

    $site_owners_name = 'Fernando'; // replace with your name



    $name = filter_var($_POST['contactName'], FILTER_SANITIZE_STRING);

    $email = filter_var($_POST['contactEmail'], FILTER_SANITIZE_EMAIL);

    $subject = filter_var($_POST['contactSubject'], FILTER_SANITIZE_STRING);

    $message = filter_var($_POST['contactMessage'], FILTER_SANITIZE_STRING);

    

    $error = "";



    if (strlen($name) < 2) {

        $error['name'] = "Por favor, insira seu nome.";

    }



    if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email)) {

        $error['email'] = "Por favor insira um endereço de e-mail válido";

    }



    if (strlen($subject) < 2) {

        $error['subject'] = "Introduza um assunto.";

    }



    if (strlen($message) < 2) {

        $error['message'] = "Por favor, deixe um comentário.";

    }



    if (!$error) {



        require_once('phpmailer/class.phpmailer.php');

        $mail = new PHPMailer();



        $mail->From = $email;

        $mail->FromName = $name;

        $mail->Subject = $subject;

        

        $mail->AddAddress($site_owners_email, $site_owners_name);

        $mail->IsHTML(true);

        $mail->Body = '<b>Sender Name:</b> '. $name .'<br/><b>Sender E-mail:</b> '. $email . '<br/><br/><b>Sender Message:</b><br/>' . $message;



        $mail->Send();



        echo "<div class='alert alert-success' role='alert'>Obrigado " . $name . ". Sua mensagem foi enviada.</div>";



    } # end if no error

    else {



        $response = (isset($error['name'])) ? "<div class='alert alert-danger'  role='alert'>" . $error['name'] . "</div> \n" : null;

        $response .= (isset($error['email'])) ? "<div class='alert alert-danger'  role='alert'>" . $error['email'] . "</div> \n" : null;

        $response .= (isset($error['subject'])) ? "<div class='alert alert-danger'  role='alert'>" . $error['subject'] . "</div>" : null;

        $response .= (isset($error['message'])) ? "<div class='alert alert-danger'  role='alert'>" . $error['message'] . "</div>" : null;



        echo $response;

    } # end if there was an error sending



?>

 

mais não envia.

 

quando aperto em envia fica parado mais n envia

 

c4042dbaca3f47398329479d0fa2bd54.png

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...