Guest User

Untitled

a guest
Nov 30th, 2017
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <form id="test" method="post" action="employment-applicationreceived.php">
  2. <div class="backgroundform">
  3. <li id="li_1" >
  4. <label class="description2" for="element_1">Name: </label>
  5. <input id="req_name" name= "req_name" class="element text" maxlength="255" size="28" value=""/>
  6. </form>
  7.  
  8. <?php
  9. require_once "Mail.php";
  10. require_once "Mail/mime.php";
  11.  
  12. $from = "Test <test@testing.com>";
  13. $to = "Test <test@testing.com>";
  14. $subject = "Test HTML email using PHP Pear w/ SMTPrnrn";
  15. $text = "This is a text test email message";
  16. $html = "<html><body><html><body>
  17. <strong>PERSONAL INFORMATION</strong>
  18. <table>
  19. <tr style='background: #999;'><td height='2'></td><td>
  20. <tr><td>First Name: </td><td width='500'>$req_name = $_POST['req_name'];</td>
  21. </table></body></html>";
  22.  
  23. $crlf = "n";
  24.  
  25. $mime = new Mail_mime($crlf);
  26. $mime->setTXTBody($text);
  27. $mime->setHTMLBody($html);
  28.  
  29. $host = "hostname";
  30. $port = "25";
  31. $username = 'test@testing.com';
  32. $password = '***';
  33.  
  34. $headers = array ('From' => $from,
  35. 'To' => $to,
  36. 'Subject' => $subject);
  37. $smtp = Mail::factory('smtp',
  38. array ('host' => $host,
  39. 'auth' => true,
  40. 'username' => $username,
  41. 'password' => $password));
  42.  
  43.  
  44. $body = $mime->get();
  45. $headers = $mime->headers($headers);
  46.  
  47. $mail = $smtp->send($to, $headers, $body);
  48.  
  49. if (PEAR::isError($mail)) {
  50. echo("
  51. " . $mail->getMessage() . "
  52. ");
  53. } else {
  54. echo("
  55. Message successfully sent!
  56. ");
  57. }
  58. ?>
Add Comment
Please, Sign In to add comment