Recent Topics

1 Apr 25, 2005 06:57    

Well, thanks to STK's instructions : http://www.randsco.com/index.php/2005/04/06/posting_via_email, I can now post via email, which is a very good thing.

I noticed that in the /conf/advanced.php file, there are only listings for one email server/address/blog/, however, and I would like to set up some way to post to a few of my blogs via email. I figure the easiest way would be to create a separate POP3 account for each blog, and then modify /htsrv/getmail.php so that it loops through the checking of email for each account.

I could probably add into /conf/advanced.php more variables, such as:


$mailserverTwo_url = 'pop.YourServer.net';
$mailserverTwo_login = 'UserName@YourServer.net';
$mailserverTwo_pass = 'YourPassword';
$mailserverTwo_port = 110; 

$mailserverThree_url = 'pop.YourServer.net';
$mailserverThree_login = 'UserName@YourServer.net';
$mailserverThree_pass = 'YourPassword';
$mailserverThree_port = 110; 

but I guess since I am using the same mailserver, I could just have the login and password with added values.

Unfortunately, I am a PHP beginner, (though I have a lot of antiquated perl experience) and am trying to slog my way through getmail.php, and aside from literally duplicating the script within itself (once for each blog) I have no ideas. I would love something more elegant, however.

The only real problem is that I can't find where in getmail.php it specifies which blog to post the email to. Unless I am misunderstanding what get_catblog($post_category) returns when used here:


	if( ! ($post_category = xmlrpc_getpostcategory($content) ) )
	{
		$post_category = $default_category;
	}
	echo '<p><strong>', T_('Category ID'), ':</strong> ',$post_category,'</p>';

	$content = xmlrpc_removepostdata( $content );
	
	$blog_ID = get_catblog($post_category); // TODO: should not die, if cat does not exist!

If get_catblog returns the blog id (am I correct in assuming that each category has a unique ID, and therefore the category will force the blog ID) then I guess I don't even need to have separate POP3 accounts, just remember which category goes with which blogs!

oy. I feel like I'm rambling. I guess my best bet is to try playing with the categories.

3 Apr 27, 2005 06:08

rocketdyke,

Glad my tute helped you get going. I've been meaning to add the bit about changing categories. Wish you had asked. ;)

On a related matter, I just came across [url=http://sourceforge.net/projects/blag/]BL@G[/url] which is an email-2-blog php script that provides JPG attachments.

I tried to get the thing going, but didn't succeed. Maybe you could have a peek (if JPG attachments are to your liking?)

The way it works: Email special address & pass username/pwd/cat/blog# in the email, using the following format

username::uname
password::pwd
category::32

. Title is Subject. Email is forwarded to the script via a forwarding command (usually done in cPanel with a pipe command

| /usr/bin/php -f /home/yoursite/public_html/somedir/blag.php

. Php script(s) then parse the email into XML-format and the entry/JPG attachment is added like an RSS feed might be. WP has a similar plugin, based on some univeral code.

Interesting, but I'm stymied about getting it going. Maybe you could give it a whirl?

-Scott

4 Apr 27, 2005 10:00

Well, you've got me stumped.

I tried the basic install, and got nowhere. I think I'm having a problem with my email redirect, as a simple pipe doesn't seem to want to work. I've tried a few variations on pipes redirecting to text files in my homedir, but no luck.

I'm wondering if we can incorporate this fellow's php into the getmail.php from the standard email to blog scenario.

There is always the cheating option, using http://www.flickr.com which can link photos to blogs automatically. I prefer the idea of using open-source as opposed to relying on a commercial service, however.

I'll have to spend some more time looking at this script, and possibly figuring a way to have it call a pop3 email box instead of having to do the redirect.

-R

5 Apr 27, 2005 13:43

Hmmm. I guess I managed to get a bit further than you, as I was able to forward the email to the php script using the command above. (The "/usr/bin/php -f" is required on my host server, otherwise it just doesn't know the command is supposed to be run as php). Maybe your php libs are in a different location?

Until I put that in, I didn't get anywhere with the recommended "pipe /dir/string/phpFile.php" redirect.

Anyway ... just a thought.

I was hoping that you'd get as far as I did (well, further actually ;) ) which was to generate a "XML error" that made no sense and which I haven't been able to track yet. A b2emo_log.txt file is generated, upon successful redirection, containing the error:

[25-Apr-2005 23:09:50] XML error: junk after document element at line 2

.

That's as far as I got.

Would be very nice to get a JPG attachment working. (However it's accomplished) :D

I also got the impression that the author was intending for OTHER file extension attachments to be handled as well, but only the JPG one has been written.

I emailed the author, but haven't had a reply. The project has a homepage and a test blog, but I was unable to get an email posted there, as well. (Tho I now note that the test blog is EMPTY ... so he's working on something, as the test blog contained many entries, when I first began working with the script(s) - many entries had pictures.

Anything you can contribute would be helpful and greatly appreciated! :)

-Scott

6 Sep 07, 2005 06:29

I feel like such a sellout, but okay, I cheated.

I went through flickr as yahoo has promised that they will keep things the same (ha!) and try as I might, I couldn't get bl@g to work.

I would love more flexibility than what flickr gives, but it is better than nothing.

have you had any luck in the intervening months, Scott?

-R

7 Sep 07, 2005 07:07

I have contacted the author of the program and was promised that some redo's would be forthcoming.

Alas, nothing much has happened and it appears that the candle has flickr'd out (so to speak).

I'm into other things, at the moment, finalizing PZ2 (photo zoom 2) and trying to get back into the academic mood (autumn).

Currently, I'm not in need of a photo-to-blog solution, but am eager to see it happen, as I can see a real need for it when we begin our sail around the World.

Hope all is well in your realm,

-stk


Form is loading...