Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. if(!$mail->send()) {
  2. echo 'Message could not be sent.';
  3. echo 'Mailer Error: ' . $mail->ErrorInfo;
  4. } else {
  5. echo 'Message has been sent';
  6. }
  7.  
  8. <?php
  9. require 'C:wampwwwphpmailerPHPMailer-masterPHPMailerAutoload.php';
  10.  
  11. $mail = new PHPMailer;
  12.  
  13. if (isset($_POST['submit'])) {
  14.  
  15. //$mail->SMTPDebug = 3; // Enable verbose debug output
  16.  
  17. $mail->isSMTP(); // Set mailer to use SMTP
  18. $mail->Host = 'smtp.gmail.com '; // Specify main and backup SMTP servers
  19. $mail->SMTPAuth = true; // Enable SMTP authentication
  20. $mail->Username = 'test@gmail.com'; // SMTP username
  21. $mail->Password = 'password'; // SMTP password
  22. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  23. $mail->Port = 587; // TCP port to connect to
  24.  
  25. $mail->setFrom('from@example.com', 'Mailer');
  26. $mail->addAddress('tester@gmail.com', 'Marco'); // Add a recipient
  27. //$mail->addAddress('ellen@example.com'); // Name is optional
  28. //$mail->addReplyTo('info@example.com', 'Information');
  29. //$mail->addCC('cc@example.com');
  30. //$mail->addBCC('bcc@example.com');
  31.  
  32. $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  33. $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  34. $mail->isHTML(true); // Set email format to HTML
  35.  
  36. $mail->Subject = 'NEW APPLICATION';
  37. $mail->Body = "--PERSONAL INFORMATION--
  38. First Name: $fname Middle Name: $mname Last Name: $lname
  39. Address:$address City:$city State:$state Zip:$zip ";
  40.  
  41. //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  42.  
  43.  
  44. }
  45. ?>
  46.  
  47. <input type="hidden" name="submit" value="foo" />
  48.  
  49. <input type="submit" value="Submit!" name="submit" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement