Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. Hi,
  2.  
  3.  
  4.  
  5. <?php
  6. include('libs/PHPMailer-master/PHPMailerAutoload.php');
  7. //require 'PHPMailerAutoload.php';
  8. //require 'system/includes/PHPMailer/PHPMailerAutoload.php';
  9. $mail = new PHPMailer;
  10.  
  11. //$mail->SMTPDebug = 3; // Enable verbose debug output
  12.  
  13. $mail->isSMTP(); // Set mailer to use SMTP
  14. $mail->Host = gethostbyname("smtp.slt.com.lk"); // Specify main and backup SMTP servers
  15. $mail->SMTPAuth = true; // Enable SMTP authentication
  16. //$mail->Username = 'user@example.com'; // SMTP username
  17. //$mail->Password = 'secret'; // SMTP password
  18. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  19. $mail->Port = 587; // TCP port to connect to
  20.  
  21. $mail->setFrom(ex@slt.com.lk', 'Mailer');
  22. $mail->addAddress('ex@slt.com.lk', 'Joe User'); // Add a recipient
  23. //$mail->addAddress('ellen@example.com'); // Name is optional
  24. //$mail->addReplyTo('info@example.com', 'Information');
  25. //$mail->addCC('cc@example.com');
  26. //$mail->addBCC('bcc@example.com');
  27.  
  28. //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  29. //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  30. $mail->isHTML(true); // Set email format to HTML
  31.  
  32. $mail->Subject = 'Here is the subject';
  33. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  34. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  35.  
  36. if(!$mail->send()) {
  37. echo 'Message could not be sent.';
  38. echo 'Mailer Error: ' . $mail->ErrorInfo;
  39. } else {
  40. echo 'Message has been sent';
  41. }
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement