Narendra123

send and bulk email php

Oct 1st, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. <!---- send single email ------------------------->
  2.  
  3. $recipient = "info@srimaharajainn.com";
  4.  
  5. // Mail subject
  6. $subject = "Good news! A reservation has been requested by $email";
  7.  
  8. // Mail content
  9. $email_content = "Booking Enquiry from $fname
  10. /// in mail content show like this
  11. Arrival: $arrival
  12. Departure: $departure
  13.  
  14. Phone : $phone
  15. Message: $message";
  16.  
  17. // Mail headers
  18. $email_headers = "From:info@srimaharajainn.com";
  19.  
  20. // Main messages
  21. if (mail($recipient, $subject, $email_content, $email_headers))
  22. {
  23. echo "<h1>Email has been sent successfully!</h1>";
  24. }
  25. else
  26. {
  27. echo "<p>Oops! Something went wrong and we couldn't send your reservation.</p>";
  28. }
  29. else
  30. {
  31. echo "<p>There was a problem with your submission, please try again.</p>";
  32. }
  33. <!------- /// send single email ------------------->
  34.  
  35. <!----- bulk email ---------------------------->
  36.  
  37. <?php
  38. if(isset($_POST['frm_chk'])){
  39. $_Chk_box_value = $_POST['frm_chk'];
  40. $subject1=$_POST['subject'];
  41. $message=$_POST['message'];
  42. echo $to = implode(',',$_Chk_box_value);
  43. //echo 'Pass this to mail() funtion Recipients : '.$to;
  44. $recipient = $to;
  45.  
  46. // Mail subject
  47. $subject = $subject1;
  48.  
  49. // Mail content
  50. $email_content = "
  51. Message : $message
  52. ";
  53.  
  54. // Mail headers
  55. $email_headers = "From:bnarendra6036@gmail.com";
  56.  
  57. // Main messages
  58. if (mail($recipient, $subject, $email_content, $email_headers))
  59. {
  60. echo "<h1>Email has been sent successfully!</h1>";
  61. }
  62. else
  63. {
  64. echo "<p>Oops! Something went wrong and we couldn't send your reservation.</p>";
  65. }
  66.  
  67. }
  68. ?>
  69. <html>
  70. <body>
  71. <form name="form1" action="" method="post">
  72. <!--
  73. Dynamically You Can Print the Check Boxes here....
  74. -->
  75.  
  76. <input type="checkbox" name="frm_chk[]" value="bnarendra6036@gmail.com" />bnarendra6036@gmail.com<br>
  77. <input type="checkbox" name="frm_chk[]" value="rajashekar9426@gmail.com" />rajashekar9426@gmail.com<br>
  78. Subject : <input type="text" name="subject"><br><br>
  79. Message : <textarea name="message" cols="20" rows="5"></textarea><br><br>
  80. <!--
  81. .....With Other Elements
  82. -->
  83. <input name="" type="submit">
  84. </form>
  85. </body>
  86. </html>
  87. <!-------------- //bulk email ------------------------------->
Add Comment
Please, Sign In to add comment