Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. require 'phpmailer/PHPMailerAutoload.php';
  2.  
  3. $mail = new PHPMailer;
  4.  
  5. //$mail->SMTPDebug = 3; // Enable verbose debug output
  6.  
  7. $mail->isSMTP(); // Set mailer to use SMTP
  8. $mail->Host = 'smtp.office365.com'; // Specify main and backup SMTP servers
  9. $mail->SMTPAuth = true; // Enable SMTP authentication
  10. $mail->Username = 'Info@intellispyre.com'; // SMTP username
  11. $mail->Password = '@PHP'; // SMTP password
  12. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  13. $mail->Port = 587; // TCP port to connect to
  14.  
  15. $mail->setFrom('Info@intellispyre.com', 'IntelliSpyre Automated Service');
  16. $mail->addAddress(strval($email), strval($fname)); // Add a recipient
  17. //$mail->addAddress('ellen@example.com'); // Name is optional
  18. $mail->addReplyTo('info@example.com', 'Information');
  19. //$mail->addCC('cc@example.com');
  20. //$mail->addBCC('bcc@example.com');
  21.  
  22. //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  23. //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  24. $mail->isHTML(true); // Set email format to HTML
  25.  
  26. $mail->Subject = 'Welcome to IntelliSpyre';
  27. $mail->Body = 'This is an automated message sent by IntelliSpyre , Your username is :'.$usname.' Your password :'.$password;
  28. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  29.  
  30. if(!$mail->send()) {
  31. echo 'Message could not be sent.';
  32. echo 'Mailer Error: ' . $mail->ErrorInfo;
  33. } else {
  34.  
  35. header("Location:admin.php");
  36.  
  37. }
  38. }
  39. else
  40. {
  41. echo "<script>
  42. alert('Invalid Email');
  43. window.location.href='admin.php';
  44. </script>";
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement