Created
          September 27, 2018 22:35 
        
      - 
      
- 
        Save pedrovasconcellos/5ae06345e4ce063870335ac5c57b51be to your computer and use it in GitHub Desktop. 
    Email Trigger In Php
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| header('Content-Type: text/html; charset=utf-8'); | |
| ini_set('default_charset','UTF-8'); | |
| function acentuacao_assunto($string){ return '=?UTF-8?B?'.base64_encode($string).'?='; } | |
| //https://vasconcellossolutions.com | |
| //https://vasconcellos.site | |
| $emailrecipient = "[email protected]"; | |
| $senderemail = $_POST['email']; | |
| $sender = $emailrecipient; | |
| $name = $_POST['name']; | |
| $subject = $_POST['subject']; | |
| $text = $_POST['emailtext']; | |
| $telephone = $_POST['telephone']; | |
| $subject = $subject." - ".date("d/m/Y H:i"); | |
| $finaltext = | |
| "E-mail: ".$senderemail." | |
| Nome: ".$name."\n | |
| Assunto: ".$subject." | |
| Telefone: ".$telephone."\n | |
| Mensagem: \n".$text."\n\n | |
| Enviado: ".date("d/m/Y H:i").""; | |
| $headers = "From: $senderemail\r\n"; | |
| $headers .= "Reply-To: $senderemail\r\n"; | |
| $envio = mail($emailrecipient,acentuacao_assunto($subject), $finaltext, $headers); | |
| if($envio) { | |
| echo '<script> alert("Formulário enviado com sucesso!"); | |
| window.location.assign("index.html"); | |
| </script>'; | |
| } | |
| else { | |
| echo '<script> alert("Falha ao enviar o Formulário."); | |
| window.location.assign("index.html"); | |
| </script>'; | |
| } | |
| ?> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment