Enviar Email Em Evento Personalizado


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. ################################################################
  2. # Adicionar este código dentro da função __trigger() do evento #
  3. ################################################################
  4.  
  5. # Pega os campos vindo via POST
  6. $fields = $_POST['fields'];
  7.  
  8. # Monta o corpo da mensagem
  9. $message = "Nome: " .$fields['nome'] ."
  10. ";
  11. $message .= "Email: " .$fields['email'] ."
  12. ";
  13. $message .= "Empresa: " .$fields['empresa'] ."
  14. ";
  15. $message .= "Telefone: " .$fields['telefone']."
  16. ";
  17. $message .= "Mensagem: " .$fields['mensagem']."
  18. ";
  19.  
  20. # Array com as configurações do email
  21. $email = array();
  22. $email['to_email'] = '[email protected]';
  23. $email['from_email'] = '[email protected]';
  24. $email['from_name'] = $fields['nome'];
  25. $email['subject'] = 'Assunto';
  26. $email['message'] = General::sanitize(trim($message));
  27. $email['headers'] = array('Content-Type' => 'text/plain; charset=UTF-8');
  28.  
  29. ## Send it!
  30. if (!General::sendEmail($email['to_email'], $email['from_email'], $email['from_name'], $email['subject'], $email['message'], $email['headers'])){
  31. Frontend::instance()->Log->pushToLog("Email were not sent.", Log::kERROR, true);
  32. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.