Post via email
-
I want to be able to post special offers on my website through emailing them to a specific email (already configured) and have them render on the website.
I have the email account set up on my host site (newpost@minihanscork.com) and configured in WordPress to the best of my knowledge. The emails go to the account but I have tried multiple different ways of making them then render on the website through the code provided on the WordPress-Codex site but I cant get any of them to work for me.
Does it matter from what account I use to email the new email account because at present I am using a gmail account with this code in my functions.php page:
add_action(‘shutdown’, ‘retrieve_post_via_mail’);
function retrieve_post_via_mail() {
flush(); // Display the page before the mail fetching begins
if(get_transient(‘retrieve_post_via_mail’)) {
return; // The mail has been checked recently; don’t check again
} else { // The mail has not been checked in more than 15 minutes
$mail = wp_remote_get(get_bloginfo(‘wpurl’).’/wp-mail.php’);
if(!is_wp_error($mail)) { // If retrieve succeeded
set_transient(‘retrieve_post_via_mail’, 1, 60 * 15); // check again in 15 minutes.
} else {
set_transient(‘retrieve_post_via_mail’, 1, 60 * 5); // check again in 5 minutes; we don’t want to overload the server
}
}
}Any suggestions?
Thanks
- The topic ‘Post via email’ is closed to new replies.