Advertisement
Guest User

Untitled

a guest
Sep 8th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.37 KB | None | 0 0
  1. <?php
  2. require 'PHPMailerAutoload.php';
  3. $mail = new PHPMailer;
  4. $mail->isSMTP();
  5. $mail->Host = 'localhost';
  6.  
  7. //sumbission data
  8. $ipaddress = $_SERVER['REMOTE_ADDR'];
  9. $date = date('d/m/Y');
  10. $time = date('H:i:s');
  11.  
  12. //form data
  13. $name = $_POST['name'];
  14. $email = $_POST['email'];
  15. $subject = $_POST['subject'];
  16. $tel = $_POST['tel'];
  17. $sad = $_POST['sad'];
  18.  
  19. $message = $_POST['message'];
  20.  
  21.  
  22. //$mail->SMTPDebug = 3;                               // Enable verbose debug output
  23.  
  24. // $mail->isSMTP();                                      // Set mailer to use SMTP
  25. // $mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
  26. // $mail->SMTPAuth = true;                               // Enable SMTP authentication
  27. // $mail->Username = 'user@example.com';                 // SMTP username
  28. // $mail->Password = 'secret';                           // SMTP password
  29. // $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
  30. // $mail->Port = 587;                                    // TCP port to connect to
  31.  
  32. $mail->setFrom($email, 'Trust');
  33. $mail->addAddress('edikius@gmail.com', 'Trust');     // Add a recipient
  34. // $mail->addAddress('ellen@example.com');               // Name is optional
  35. $mail->addReplyTo($email, 'Trust');
  36. $mail->addCC('cc@example.com');
  37. $mail->addBCC('bcc@example.com');
  38.  
  39. $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
  40. $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
  41. $mail->isHTML(true);                                  // Set email format to HTML
  42.  
  43. $mail->Subject = 'wniosekSDE.pl - admin';
  44. $mail->Body    = "<p>You have recieved a new message from the enquiries form on your website.</p>
  45.                           <p><strong>Name: </strong> {$name} </p>
  46.                           <p><strong>Email Address: </strong> {$email} </p>
  47.                           <p><strong>Telephone: </strong> ${tel} {$test} </p>
  48.                           <p><strong>Sąd: </strong> {$sad} </p>
  49.                           <p><strong>Subject: </strong> {$subject} </p>
  50.                           <p><strong>Message: </strong> {$message} </p>
  51.                           <p>This message was sent from the IP Address: {$ipaddress} on {$date} at {$time}</p>";
  52. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  53.  
  54. if(!$mail->send()) {
  55.     echo 'Message could not be sent.';
  56.     echo 'Mailer Error: ' . $mail->ErrorInfo;
  57. } else {
  58.     echo 'Message has been sent';
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement