Advertisement
Guest User

Untitled

a guest
Feb 27th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. enter code here
  2. [![<body>
  3. <form name="FromID" method="post"><br>
  4. <br>
  5. <div align="center" style="font-family:Times New Roman; font-size:25px;font-weight:bold; ">COMPLAINTS ASSIGNED</div>
  6. <br>
  7. <br>
  8. <table border="1%" cellpadding="0" cellspacing="0" align="center" style="width:30%">
  9. <tr>
  10. <td colspan="2" width="5"><b>Staff Members</b></td>
  11. <td>
  12. <select id="staff" name="staff">
  13. <option value="s1">Athiyamaan</option>
  14. <option value="s2">Pazhanivel</option>
  15. <option value="s3">Sampath</option>
  16. <option value="s4">Sundharamoorthy</option>
  17. <option value="s5">Karthik</option>
  18. <option value="s6">Prabaharan</option>
  19. </select>
  20. </td>
  21. </tr>
  22. <tr>
  23. <td colspan="2" width="5"><b>E-mail</b></td>
  24. <td><input type="email" id="email" name="email" size="19" placeholder="joh@gmail.com" required>
  25. </td></tr>
  26. <tr>
  27. <td colspan="2" width="5"><b>Remarks</b></td>
  28. <td><textarea id="msg" rows="6" name="message" cols="20" placeholder="enter text here" required></textarea></td>
  29. </tr>
  30. <tr><td colspan="4" align="center">
  31. <input type='submit' value='submit' name="submit"></td>
  32. </tr>
  33. <?php
  34. if(isset($_POST['submit'])) {
  35. $errors = '';
  36. $myemail = 'rizwanamtech93@gmail.com';//<-----Put Your email address here.
  37. if(empty($_POST['staff']) ||
  38. empty($_POST['email']) ||
  39. empty($_POST['message']))
  40. {
  41. $errors .= "n Error: all fields are required";
  42. }
  43.  
  44. $name = $_POST['staff'];
  45. $email_address = $_POST['email'];
  46. $message = $_POST['message'];
  47. //$body = "From: $namen E-Mail: $email_addressn Message:n $message";
  48. if (!preg_match(
  49. "/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i",
  50. $email_address))
  51. {
  52. $errors .= "n Error: Invalid email address";
  53. }
  54.  
  55. if( empty($errors))
  56. {
  57. $to = $myemail;
  58. $email_subject = "form submission: $name";
  59. $email_body = "You have received a new message. ".
  60. " Here are the details:n Name: $name n Email: $email_address n Message n $message";
  61.  
  62. $headers = "From: $myemailn";
  63. $headers .= "Reply-To: $email_address";
  64.  
  65. mail($to,$email_subject,$email_body,$headers);
  66.  
  67. }
  68. }
  69. ?>
  70.  
  71. <?php
  72. require 'PHPMailer-master/PHPMailerAutoload.php';
  73.  
  74. $mail = new PHPMailer;
  75.  
  76. //$mail->SMTPDebug = 3; // Enable verbose debug output
  77.  
  78. $mail->isSMTP(); // Set mailer to use SMTP
  79. $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
  80. $mail->SMTPAuth = true; // Enable SMTP authentication
  81. $mail->Username = 'rizwanamtech93@gmail.com'; // SMTP username
  82. $mail->Password = 'subanallah'; // SMTP password
  83. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  84. $mail->Port = 587; // TCP port to connect to
  85.  
  86. $mail->setFrom('from@example.com', 'Mailer');
  87. $mail->addAddress('rizwanamtech93@gmail.com', 'test User'); // Add a recipient
  88. //$mail->addAddress('ellen@example.com'); // Name is optional
  89. $mail->addReplyTo('rizwanamtech9316@gmail.com', 'Information');
  90. //$mail->addCC('cc@example.com');
  91. //$mail->addBCC('bcc@example.com');
  92.  
  93. //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  94. //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  95. $mail->isHTML(true); // Set email format to HTML
  96.  
  97. $mail->Subject = 'Remarks statement';
  98. $mail->Body = "You have received a new message.";
  99. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  100.  
  101. if(!$mail->send()) {
  102. echo 'Message could not be sent.';
  103. echo 'Mailer Error: ' . $mail->ErrorInfo;
  104. } else {
  105. echo 'Message has been sent';
  106. }
  107.  
  108. ?>
  109. </table><br><br>
  110. </form>
  111. </body>][1]][1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement