/var/www/vhosts/sivana.com.br/httpdocs/enviar.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php

$nome 
utf8_decode ($_POST["nome"]);
$email utf8_decode ($_POST["email"]);
$fone utf8_decode ($_POST['fone']);
$assunto utf8_decode ($_POST['assunto']);
$empresa utf8_decode ($_POST['empresa']);
//$setor = utf8_decode ($_POST['setor']);
$mensagem utf8_decode (nl2br($_POST["mensagem"]));
// Verifica se o nome foi preenchido




// enviar e-mail //
function enviar(){
    global 
$nome;
    global 
$email;
    global 
$fone;
    global 
$empresa;
    global 
$assunto;
    
//global $setor;
    
global $mensagem;

include(
"mail/class.phpmailer.php");
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded



        
$mail             = new PHPMailer();
        
        
//$body             = $mail->getFile('contents.html');
        //$body             = eregi_replace("[\]",'',$body);
        
        
$mail->IsSMTP();
        
$mail->SMTPAuth   true;                  // enable SMTP authentication
        //$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
        
$mail->Host       "smtp.sivana.com.br";      
        
$mail->Port       587;                   
        
        
$mail->Username   "webmaster@sivana.com.br";  
        
$mail->Password   "09sivana";  
        
        
        
        
$mail->From       "webmaster@sivana.com.br";
        
$mail->FromName   "Site Sivana";
        
//$mail->AddReplyTo("grasiele@costamiquelin.com.br","grasiele");
        
$mail->IsHTML(true); // send as HTML
        

        
$mail->Subject    $assunto." - SIVANA!";
        
        
$body       "
        <html>
        <head>
        <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
        </head>
        <body>
        <table width='500' border='0' cellspacing='1' cellpadding='1'>
              <tr>
                <td colspan='2' align='center'><strong><font size='2' face='Arial, Helvetica, sans-serif'>..:: SIVANA - 
$assunto ::..</font></strong></td>
              </tr>
              <tr>
                <td colspan='2'><hr /></td>
                </tr>
              <tr>
                <td width='100'><div align='right'><strong><font size='2' face='Arial, Helvetica, sans-serif'>Nome:</font></strong></div></td>
                <td width='400'><font size='2' face='Arial, Helvetica, sans-serif'>
                
$nome
                </font></td>
              </tr>
              <tr>
                <td><div align='right'><strong><font size='2' face='Arial, Helvetica, sans-serif'>Empresa:</font></strong></div></td>
                <td><font size='2' face='Arial, Helvetica, sans-serif'>
                
$empresa
                </font></td>
              </tr>
              
              <tr>
                <td><div align='right'><strong><font size='2' face='Arial, Helvetica, sans-serif'>Telefone:</font></strong></div></td>
                <td><font size='2' face='Arial, Helvetica, sans-serif'>
                
$fone
                </font></td>
              </tr>
              
              <tr>
                <td><div align='right'><strong><font size='2' face='Arial, Helvetica, sans-serif'>E-mail:</font></strong></div></td>
                <td><font size='2' face='Arial, Helvetica, sans-serif'>
                
$email
                </font></td>
              </tr>

              <tr>
                <td valign=top><div align='right'><strong><font size='2' face='Arial, Helvetica, sans-serif'>Mensagem:</font></strong></div></td>
                <td align=left><font size='2' face='Arial, Helvetica, sans-serif'>
                
$mensagem
                </font></td>
              </tr>
            </table>
        </body>
        </html>

        "
;                      //HTML Body
        //$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
        //$mail->WordWrap   = 50; // set word wrap
        
        
$mail->MsgHTML($body);
        
$mail->AddAddress("contato@sivana.com.br");
//        $mail->AddAddress($departamento);
        //$mail->AddBcc($filial);
        
        
if(!$mail->Send()) {
          echo 
"Ocorreu um erro durante o envio do email.";
         } else {
            echo 
false;
            
        }
}
//fim email //    

        
enviar();
        
        echo 
false;
    
// Se houver algum erro ao inserir
    

?>