I have been trying for a while now to use wp_mail to send an email from within my plugin. The code I’m using is as follows.
function add_page_content_Send_Feed(){
echo "<h2>Send your feed via email</h2>";
echo "<form id='post' action='' method='POST'>";
echo "<input type="submit" name="send_feed" value="Send my feed" id='submit';'/>";
echo "</form>";
// Example using the array form of $headers
// assumes $to, $subject, $message have already been defined earlier...
$headers[] = 'From: UltraIT <demo@ultrait.org>';
$headers[] = 'Cc: John Q Codex <jqc@wordpress.org>';
$headers[] = 'Cc: iluvwp@wordpress.org'; // note you can just use a simple email address
$to = 'jesseorange360@gmail.com';
$subject="TESTING";
$message="hello";
if(isset($_POST['send_feed'])) {
wp_mail( $to, $subject, $message, $headers);
}
}
This however is not working… Can anyone tell me what I’m doing wrong?