vishwamano

source of vishwamano.com
git clone git://git.ricketyspace.net/vishwamano.git
Log | Files | Refs

commit f5c447b4eb9bcb7d822c153f9ff14de1dbba5689
parent e9c3af47d05d00ab6a2f4b060ab4ea4a3d0dc2ce
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date:   Thu,  1 Jan 2015 17:59:43 -0500

utils.php: added send_message function.

Diffstat:
utils.php | 40++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+), 0 deletions(-)

diff --git a/utils.php b/utils.php @@ -138,4 +138,44 @@ function request_shoot($email) { } return $alert; +} + + +function send_message($email) { + $to = $email; + $name = $_POST['name']; + $email_address = $_POST['email']; + $message = $_POST['message']; + $humantest = $_POST['humantest']; + + $humantest_answer= "100"; + + if((strcmp($humantest, $humantest_answer)== 0) and + (!empty($email_address) and !empty($message))) { + + $email_subject = "[VishaMano.com] Message from $name"; + + $email_body = "$name <$email_address> has messaged you. \n\n". + "The Message:\n\n$message"; + //"\n\n$name 's email address is $email_address"; + + $headers = "From: no-reply@vishwamano.com\n"; + $headers .= "Reply-To: $email_address"; + + mail($to,$email_subject,$email_body,$headers); + + $alert_msg = 'Your message has been sent to <strong>Vishwa Manoharan</strong>.'; + $alert = array( 'type' => 'success', + 'content' => $alert_msg); + + } + else { + + $alert_msg = '<strong> Error: Message not sent</strong>. Please try again.' + . ' If problem persists email <strong>Vishwa Manoharan' + . ' &lt;vishwa91photography@gmail.com&gt;.</strong>'; + $alert = array( 'type' => 'danger', + 'content' => $alert_msg); + } + return $alert; } \ No newline at end of file