Guest User

Untitled

a guest
Jul 3rd, 2018
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. <form id="form" action="vendor/sendmail.php" method="post">
  2. <div class="field">
  3. <label class="label">Name</label>
  4. <div class="control">
  5. <input class="input" type="text" name="nome" placeholder="Name">
  6. </div>
  7. </div>
  8.  
  9. <div class="field">
  10. <label class="label">Email</label>
  11. <div class="control">
  12. <input class="input" type="email" name="email" placeholder="Email">
  13. </div>
  14. </div>
  15.  
  16. <div class="field">
  17. <label class="label">Message</label>
  18. <div class="control">
  19. <textarea class="textarea" name="mensagem" placeholder="Message"></textarea>
  20. </div>
  21. </div>
  22.  
  23. <div class="field is-grouped">
  24. <div class="control">
  25. <button class="button is-link">Submit</button>
  26. </div>
  27. </div>
  28. </form>
  29.  
  30. $nome = $_POST["nome"];
  31. $email = $_POST["email"];
  32. $mensagem = $_POST["mensagem"];
  33.  
  34. // These must be at the top of your script, not inside a function
  35. use PHPMailerPHPMailerPHPMailer;
  36. use PHPMailerPHPMailerException;
  37.  
  38. //Load Composer's autoloader
  39. require 'autoload.php';
  40.  
  41. $mail = new PHPMailer(true); // Passing `true` enables exceptions
  42. try {
  43. //Server settings
  44. $mail->SMTPDebug = 2; // Enable verbose debug output
  45. $mail->isSMTP(); // Set mailer to use SMTP
  46. $mail->Host = 'mail.eftmkg.com'; // Specify main and backup SMTP servers
  47. $mail->SMTPAuth = true; // Enable SMTP authentication
  48. $mail->Username = 'info@eftmkg.com'; // SMTP username
  49. $mail->Password = 'xxxxxxxxxxxx'; // SMTP password
  50. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  51. $mail->Port = 587; // TCP port to connect to
  52.  
  53. //Recipients
  54. $mail->setFrom('info@eftmkg.com', 'Mailer');
  55. $mail->addAddress('kaio.maia.so@gmail.com', 'Kaio Maia'); // Add a recipient
  56. $mail->addAddress('info@eftmkg.com'); // Name is optional
  57. $mail->addReplyTo('info@eftmkg.com', 'Info');
  58. //$mail->addCC('cc@example.com');
  59. //$mail->addBCC('bcc@example.com');
  60.  
  61. //Attachments
  62. $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  63. $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  64.  
  65. //Content
  66. $mail->isHTML(true); // Set email format to HTML
  67. $mail->Subject = 'EFTMKG';
  68. $mail->Body = '$mensagem';
  69. //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  70.  
  71. $mail->send();
  72. echo 'Message has been sent';
  73. } catch (Exception $e) {
  74. echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  75. }
  76.  
  77. //Attachments
  78. $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  79. $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
Add Comment
Please, Sign In to add comment