Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Just putting my feelers out on this one, I need to be able to accept incoming emails and add them as posts, however I want to be able to do a bit of processing first, for example I want to change the slug, prepend a string to the title etc.

Is there a way I can hook into the email function, change some data and then let it continue. I also might want to reject the email if it isn't sent from an approved domain (this will be a field in a custom post type).

Are my requirements achievable or am I barking up the wrong tree?

Edit

I have discovered the save_post hook, although it fires after the post has saved... not really what I'm looking for. Is there a hook that gets fired before a post is saved, giving me all the info about the post, especially where it's been created from.

Edit 2

Alternatively is there a way to add a post manually... so I handle the receiving of the email with my own code + cron, then have an API to create a new post with?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If you dig into the code of postie (plugin), you'll probably find your answer. In particular, see the filter sample files, and then trace backwards from there. From the FAQ:

Can I add special text to the body of the post when using postie?,

Yes. You can create your own function, and use the postie_post filter. Two short examples are included in the filterPostie.php.sample file

Of note - per this ticket: post by email is slated to be dropped from WP core and switched over to a plugin, so you might be better-off switching to a plugin-based solution now, rather than building your functionality around the current core post by email functionality.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.