Is there any reason why wp_mail would not work inside this function?
[php]
add_action("gform_after_submission_25", "replymessage", 10, 2);
function replymessage($entry,$form) {
global $current_user;
$message = array(
'post_title' => 'ref#'.$current_user->ID,
'post_type' => 'message',
'post_status' => 'publish',
'post_author' => $current_user->ID
);
$post_id = wp_insert_post($message);
add_post_meta($post_id,'ecpt_messagecontent',$entry['1']);
add_post_meta($post_id,'ecpt_messagestatus','unread');
add_post_meta($post_id,'ecpt_messagerecipient',$entry['2']);
add_post_meta($post_id,'ecpt_messagereply',$entry['3']);
//update post as read
update_post_meta($entry['3'],'ecpt_messagestatus','replied');
wp_mail(get_user_meta($entry['2'], 'user_email', true),'You have a new message from '.get_user_meta($current_user->ID, 'first_name', true),$entry['1']);
}
I've tested wp_mail outside this function and it works fine???
Could it be something to do with the order this action is being fired in?
everything else inside this function works fine except for the mail side of things
I had to do this this way so that the recipient never finds out the email address of the person sending the message
Thanks in advance