Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("./includer/strings.class.php");
- class RHFunc{
- var $RH_Mysql;
- var $RH_Strings;
- public function __construct(){
- $this->RH_Strings = new RHStrings();
- }
- public function FormContato($Nome, $Email, $Telefone, $Mensagem){
- if(isset($Nome) && isset($Email) && isset($Telefone) && isset($Mensagem)){
- $msg = "<h2>Formulário de contato acionado</h2><br><strong>Nome:</strong> ".$Nome."<br><strong>E-mail:</strong> ".$Email."<br><strong>Telefone</strong>: ".$Telefone."<br><strong>Mensagem:</strong> ".$Mensagem."<br><br><br><small>Este e-mail foi gerado pelo sistema de contato, portanto, não responda para este e-mail.</small>";
- $msg .= "<br>----------------------------";
- $msg .= "<br>";
- $msg .= "Enviado em <strong>".date("h:m:i d/m/Y")." por ".$_SERVER['REMOTE_ADDR']."</strong>"; //mostra a data e o IP
- $msg .= "<br>";
- $msg .= "----------------------------";
- require("class.phpmailer.php");
- $mail = new PHPMailer();
- $mail->IsSMTP(); // telling the class to use SMTP
- try {
- $mail->SMTPDebug = $this->RH_Strings->Contato[6]; // enables SMTP debug information (for testing)
- $mail->Host = $this->RH_Strings->Contato[3]; // sets the SMTP server
- $mail->Port = $this->RH_Strings->Contato[4]; // set the SMTP port for the GMAIL server
- $mail->SMTPAuth = true; // enable SMTP authentication
- $mail->Username = $this->RH_Strings->Contato[0]; // SMTP account username
- $mail->Password = $this->RH_Strings->Contato[2]; // SMTP account password
- $mail->SetFrom($this->RH_Strings->Contato[0], $this->RH_Strings->Contato[1]);
- $mail->AddAddress($this->RH_Strings->Contato[8], $this->RH_Strings->Contato[9]);
- $mail->Subject = $this->RH_Strings->Contato[5];
- $mail->MsgHTML($msg);
- $mail->Send();
- echo "SMTPDebug = ".$this->RH_Strings->Contato[6]."<br>
- Host = ".$this->RH_Strings->Contato[3]."<br>
- Port = ".$this->RH_Strings->Contato[4]."<br>
- SMTPAuth = ".$this->RH_Strings->Contato[7]."<br>
- Username = ".$this->RH_Strings->Contato[0]."<br>
- Password = ".$this->RH_Strings->Contato[2]."<br>
- SetFrom = ".$this->RH_Strings->Contato[0], $this->RH_Strings->Contato[1]."<br>
- AddAddress = ".$this->RH_Strings->Contato[8], $this->RH_Strings->Contato[9]."<br>
- Subject = ".$this->RH_Strings->Contato[5]."<br>
- Mensagem = ".$msg."<br>";
- return true;
- } catch (phpmailerException $e) {
- echo $e->errorMessage(); //Pretty error messages from PHPMailer
- } catch (Exception $e) {
- echo $e->getMessage(); //Boring error messages from anything else!
- }
- return false;
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment