Created
February 27, 2014 03:14
-
-
Save luisabarca/9243710 to your computer and use it in GitHub Desktop.
Get WordPress administrator email from an external PHP script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Load WordPress | |
require_once('../../../../wp-load.php'); | |
$this_form_spam = trim($_POST['this_title']); | |
if ( empty($this_form_spam) ) { | |
// Get values from form | |
$name = $_POST['name']; | |
$phone = $_POST['phone']; | |
$email = $_POST['email']; | |
$message = $_POST['message']; | |
$to = get_option('admin_email'); | |
$subject = 'Potential Client Lead'; | |
$message = " Name: $name\r\n Phone: $phone \r\n Email: $email \r\n Message: $message"; | |
$from = "FirmFlip"; | |
$headers = "From: $email\r\n"; | |
$headers .= "Content-type: text/plain; charset=UTF-8\r\n"; | |
if(@mail($to, $subject, $message, $headers)) { | |
header('Location: /thanks/'); // Use header for redirections | |
} else { | |
echo 'Error! Please try again.'; | |
} | |
} else { | |
// @TODO: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment