Permalink
Browse files

add contact page and handler to deal with it

  • Loading branch information...
1 parent 4a5d9da commit a482b6c94394f19970c909419976f11b23de183b @derrickj committed Sep 29, 2011
Showing with 69 additions and 0 deletions.
  1. +32 −0 contact.html
  2. +37 −0 mailer.php
View
@@ -0,0 +1,32 @@
+---
+layout: base
+title: Contact
+---
+<h1>Contact Me</h1>
+<p>You may use the form below to contact me, or <a href="&#109;&#097;&#105;&#108;&#116;&#111;&#058;&#100;&#101;&#114;&#114;&#105;&#099;&#107;&#064;&#104;&#105;&#108;&#108;&#099;&#114;&#101;&#115;&#116;&#108;&#097;&#098;&#046;&#099;&#111;&#109;">email me directly</a>.</p>
+
+<form method="POST" action="mailer">
+ <label for="email">Your email address</label>
+ <input type="email" name="email" placeholder="you@example.com" id="email">
+
+ <label for="message">Message</label>
+ <textarea name="message" placeholder="Brief Message" id="message"></textarea>
+
+ <input type="submit">
+</form>
+
+<h2>Elsewhere on the Web</h2>
+ <address>
+ <ul id="social">
+ <li><img src="resources/images/social/email_16.png" width="16" height="16" alt="Email 16"><a href="&#109;&#097;&#105;&#108;&#116;&#111;&#058;&#100;&#101;&#114;&#114;&#105;&#099;&#107;&#064;&#104;&#105;&#108;&#108;&#099;&#114;&#101;&#115;&#116;&#108;&#097;&#098;&#046;&#099;&#111;&#109;">&#100;&#101;&#114;&#114;&#105;&#099;&#107;&#064;&#104;&#105;&#108;&#108;&#099;&#114;&#101;&#115;&#116;&#108;&#097;&#098;&#046;&#099;&#111;&#109;</a></li>
+
+ <li><img src="resources/images/social/twitter_16.png" width="16" height="16" alt="Twitter 16"><a href="http://www.twitter.com/derricck">@derricck</a></li>
+
+ <li><img src="resources/images/social/github_16.png" width="16" height="16" alt="Github 16"><a href="https://github.com/derrickj">derrickj on github</a></li>
+
+ <li><img src="resources/images/social/lastfm_16.png" width="16" height="16" alt="Lastfm 16"><a href="http://www.last.fm/user/derricck">derricck</a></li>
+
+ <li><img src="resources/images/social/skype_16.png" width="16" height="16" alt="Skype 16"><a href="skype:derrickj05">derrickj05</a></li>
+ </ul>
+ </address>
+
View
@@ -0,0 +1,37 @@
+---
+layout: base
+title: mailer
+---
+<?php
+$to = "&#109;&#097;&#105;&#108;&#116;&#111;&#058;&#100;&#101;&#114;&#114;&#105;&#099;&#107;&#064;&#104;&#105;&#108;&#108;&#099;&#114;&#101;&#115;&#116;&#108;&#097;&#098;&#046;&#099;&#111;&#109;"; // all messages go to my inbox
+$reply_to = $_POST['email']; // the person that used the form to send a message. So I can reply to the person from my mail client if need be
+$message = $_POST['message'];
+$subject = "My subject";
+$headers = "From:$from\r\nReply-To:$reply_to\r\n\r\n";
+$success = mail($to, $subject, $message, $headers);
+?>
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test Mail</title>
+ </head>
+ <body>
+ <h1>Test Mail</h1>
+ <div>
+ <?php
+ if ($success) {
+ echo '
+ Your message was successfully sent!
+ ';
+ } else {
+ echo '
+ There was a problem (on our end) sending your message. Sorry. A copy of your message has been placed on this page so your hard work doesn\'t go to waste.
+
+ <p>$message</p>
+ ';
+ }
+ ?>
+ </div>
+ </body>
+</html>

0 comments on commit a482b6c

Please sign in to comment.