Advertisement
Guest User

Untitled

a guest
Dec 4th, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. <?php
  2. require 'PHPMailerAutoload.php';
  3. $id=$_POST['cllgid'];
  4. $name=$_POST['signn'];
  5. $mail = new PHPMailer;
  6.  
  7. $mail->isSMTP(); // Set mailer to use SMTP
  8. $mail->Host = 'smtp.gmail.com'; // Specify main and backup server
  9. $mail->SMTPAuth = true; // Enable SMTP authentication
  10. $mail->Username = 'ballusmash@gmail.com'; // SMTP username
  11. $mail->Password = 'bitssmash1995'; // SMTP password
  12. $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
  13. $mail->Port = 587; //Set the SMTP port number - 587 for authenticated TLS
  14. $mail->setFrom('contact@bsmash.com', 'BSmash'); //Set who the message is to be sent from
  15. $mail->addReplyTo('systecnicdubai@gmail.com', 'Systecnic Solutions'); //Set an alternative reply-to address
  16. $mail->addAddress('nkgulati@gmail.com', 'Ayush Gulati'); // Add a recipient
  17. $mail->addAddress("f2013011@dubai.bits-pilani.ac.in", 'nAnga'); // Add a recipient
  18. //$mail->addCC('cc@example.com');
  19. //$mail->addBCC('bcc@example.com');
  20. $mail->WordWrap = 50; // Set word wrap to 50 characters
  21. //$mail->addAttachment('/usr/labnol/file.doc'); // Add attachments//
  22. //$mail->addAttachment('/images/image.jpg', 'new.jpg'); // Optional name
  23. $mail->isHTML(true); // Set email format to HTML
  24.  
  25. $length=8;
  26. $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$^&*";
  27. $password = substr( str_shuffle( $chars ), 0, $length );
  28.  
  29. $mail->Subject = $name;
  30. $mail->Body = $password;
  31. $mail->AltBody = 'Parent wants to request a booking';
  32.  
  33. //Read an HTML message body from an external file, convert referenced images to embedded,
  34. //convert HTML into a basic plain-text alternative body
  35. //$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  36.  
  37. if(!$mail->send()) {
  38. echo 'Message could not be sent.';
  39. echo 'Mailer Error: ' . $mail->ErrorInfo;
  40. exit;
  41. }
  42.  
  43. echo 'Message has been sent.';
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement