I am creating a function in a template that will send an email using wp_mail function.
My question is if it can be used be not logged in users or not.
I mean directly from a template file like (it's just an example, in my real example it's much more code):
<?php
/**
* Template Name: Custom Template
*
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<?php
$headers = 'From: Tester 1 <[email protected]>' . "\r\n";
$subject = 'Subject test' . "\r\n";
$message = 'Just a test stuff.';
wp_mail('[email protected]', $subject, $message, $headers );
?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
If not, how can I simulate logged in user just for this thing?
It's not working for me right now, so I was thinking that I need soem more permission maybe?