Advertisement
Guest User

Untitled

a guest
May 9th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submitted'])) {
  3.     $message = 'This is a Testmessage by '.$_POST['Name'];
  4.  
  5.     $email = 'root@localhost';
  6.     $username = 'root';
  7.     $password = '1234';
  8.     $mail_method = 'stmp';
  9.     $smtp_host = 'smtp_host'; // e.g. localhost
  10.     $smtp_port = 25;
  11.     $to_email = 'mail@receiver';
  12.     $sendmail = new Email;
  13.     $sendmail->protocol = $mail_method;
  14.     $sendmail->smtp_user = $username;
  15.     $sendmail->smtp_pass = $password;
  16.     $sendmail->smtp_host = $smtp_host;
  17.     $sendmail->smtp_port = $smtp_port;
  18.     $sendmail->mailtype = 'html';
  19.     $sendmail->from($email, 'test name');
  20.     $sendmail->to($to_email);
  21.     $sendmail->subject('Mail form on site: ' . URL_PUBLIC);
  22.     $sendmail->message($message);
  23.     $sendmail->send();
  24. } else { ?>
  25. <form method="post">
  26. <input type="hidden" name="submitted" value="1" /><br />
  27. <input type="text" name="Name" value="" />
  28. <input type="submit" value="Submit feedback" />
  29. </form>
  30. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement