SitePoint Sponsor |
|
User Tag List
Results 1 to 16 of 16
Thread: How to Post to Blog via Email?
-
Oct 24, 2006, 22:40 #1
- Join Date
- Mar 2005
- Posts
- 55
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How to Post to Blog via Email?
Would like to email an address and have its contents posted in a blog, similar to what sites like Flickr and Blogger allow you to do. Anyone know what I need to make this happen? An email parser/handler? Email gateway? Is there any way to forward an email to a webpage for processing?
-
Oct 28, 2006, 09:18 #2
- Join Date
- Jul 2005
- Posts
- 609
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can't forward an email to a web page, but you can have your web page check an email account, and act on the contents. This would require that you either use someone elses plugins or code to do this, or write your own.
-
Oct 29, 2006, 05:53 #3
- Join Date
- Jul 2004
- Location
- Leicester, UK
- Posts
- 871
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
this has intrigued me! so i'm guessing the process would be something like:
1. setup a pop3 email account specific for this use.
2. create a page that checks this account for messages.
3. add these messages to a database.
this would take a fair bit of looking into the cfpop tag but it definately sounds do-able.
http://www.cfquickdocs.com/?getDoc=cfpop
-
Oct 29, 2006, 14:41 #4
- Join Date
- Jul 2005
- Posts
- 609
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
CFPOP would be the way to go
-
Oct 29, 2006, 20:40 #5
- Join Date
- Jul 2004
- Location
- Hermosa Costa Rica
- Posts
- 1,707
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
When your done, can you post us the email address so we can ..
..see how it works?
All Im saying is that you would want some form of checking post validity, in case this email ever gets 'known'. You would be a sitting duck for comment spammers.
-
Oct 31, 2006, 00:09 #6
- Join Date
- Jul 2004
- Location
- Leicester, UK
- Posts
- 871
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
yeah - it would be a little risky, having a totally random username in the email address would help to deter spammers. you could also do some checking before the script posts for the usual list of spam words, etc.
-
Oct 31, 2006, 07:28 #7
- Join Date
- Jul 2005
- Posts
- 609
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hopefully this would be a completely random, long, email address that you'd only know because it was in your address book. And you would never post it on any site.... anywhere. Never. Ever.
-
Oct 31, 2006, 13:29 #8
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I thought that this was a really fun concept so I decided to write a quick and dirty "post via email" snippet. You can see the result here:http://www.andyandjaime.com
Here's the email that I sent:
[start]
General:Andy
~~~~~
That's right...
Usually Jaime and I add posts to our site via an elaborate admin section that I built. But this post was added via my new "email post" method. It's more of a proof-of-concept than something that will get used often, but heck. I'm a guy, I'm a programmer, and I like building new things. So I took the time to write this extra setup just because.
[/end]
The first part (above the ~~~~~) are the category names. The second part is the contents of the email. It would get inserted into the database as plain code, with no trimming or anything. So you could use any HTML or javascript that you choose.
And here's the code itself. I'll set this up as a Coldfusion scheduled task, running every 15 minutes or so. That should be plenty sufficient.
PHP Code:<!--- get all emails --->
<cfpop server="your mail server" username="the email address to check" password="password" action="getAll" name="emails">
<!--- loop over the emails to see if there are any legit records in there --->
<cfloop query="emails">
<!--- make sure that the current email being evaluated matches our "special" email --->
<cfif FindNoCase("special email two",to) OR FindNoCase("special email one",to)>
<!--- prep the variables for insertion to the database --->
<cfif FindNoCase("special email two",to)>
<cfset fk_user_id = 1>
<cfelseif FindNoCase("special email one",to)>
<cfset fk_user_id = 12>
</cfif>
<cfset thedate = DateFormat(Now(),"yyyy-mm-dd") & " " & TimeFormat(Now(),"H:mm:ss")>
<cfset title = subject>
<cfset content = ListLast(body,"~~~~~")>
<cfset cats = ListFirst(body,"~~~~~")>
<cfset status = "publish">
<!--- insert into database --->
perform your db insert here
<!--- get newest news post --->
get the id of the just inserted record
<!--- loop over the categories to get the corresponding id --->
<cfset counter = 0>
<cfloop index="li" list="#cats#" delimiters=":">
look upthe current category and make sure that one exists with that name
<!--- did we get a hit? --->
<cfif getCat.recordcount>
<!--- we did get a hit, so insert a record--->
insert the user/newsid record here8
<!--- keep a count to make sure that at least ONE category got added --->
<cfset counter = counter + 1>
</cfif>
</cfloop>
<!--- if counter is still zero, then delete the news post --->
<cfif NOT counter>
delete the news post
</cfif>
</cfif>
</cfloop>
<!--- everything went well, so delete all emails --->
<cfpop server="your mail server" username="the email address to check" password="password" action="getAll" name="delete">
Last edited by creole; Nov 1, 2006 at 09:31.
Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
-
Nov 1, 2006, 01:09 #9
- Join Date
- Jul 2004
- Location
- Leicester, UK
- Posts
- 871
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
superb stuff Andy!
-
Nov 1, 2006, 06:03 #10
- Join Date
- Jul 2005
- Posts
- 609
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So Andy, what's the email address used
?
-
Nov 1, 2006, 08:12 #11
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
-
Nov 1, 2006, 08:21 #12
- Join Date
- Jul 2005
- Posts
- 609
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok, sent an email, how long before it's on your blog :-P
-
Nov 1, 2006, 08:22 #13
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Any minute now. Just keep refreshing. While you're at it, click on a few of my banners.
Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
-
Nov 2, 2006, 06:03 #14
- Join Date
- Jul 2005
- Posts
- 609
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
HEY! It Bounced back!!!
-
Nov 2, 2006, 06:37 #15
- Join Date
- May 2005
- Location
- at http://www.gl3nnx.net
- Posts
- 343
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i know posting a blog post using email is possible from wordpress, but not with blogger.
Last edited by gl3nnx; Nov 2, 2006 at 19:50.
-
Nov 23, 2006, 09:46 #16
- Join Date
- Jun 2006
- Posts
- 128
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Sending a blog post via mail is possible in Blogger. Here's the instruction: http://help.blogger.com/bin/answer.p...452&topic=8929
Bookmarks