is it possible to create a moblog with CI

[eluser]Sally D[/eluser]
Like what tools or classes would you have to utilize to do such a thing

fetching a email on the server parsing it and uploading it

how exactly would that be done? Please don't just say yes or no just tell me what tools to use and I hope will be able to figure out how to do it thanks.

The IMAP/POP functions in PHP can help you connect to a mailserver and download email messages and attachments.

I am considering releasing a wrapper library I've created to make those functions easier to work with - they are pretty daunting!

There is a thread started by tobben who seems to be interested in email reading functionality too. I sent the message today.


[eluser]Sally D[/eluser]
sophistry I read your code and it's daunting all right there has got to be and easier way such as instead of reinventing the wheel lets build on it. How the hell does EE fetch the mail and run the moblog just copy there methods and retro fit it into your project?

I wonder if somebody can write a library maybe the guys at Ellislab can right a plugin for CI that can run a moblog after all they did it with EE. so we can do something like this in our controllers


//5 stands for seconds

$messages = $this->moblog->get_email();


you get my drift I would pay less then 35 bucks and greater then 15 dollars to use that functionality. mayBE in the next release of CI we would see that.


hi raymondm,

thanks for the feedback. sometimes it's easier not to look "under the hood", especially if you are afraid of all those twiddly bits! ;-)

i haven't put any example code up at the wiki yet, but your feedback will help shape it. especially if you actually *try* the code instead of sniffing at it.

i think you'll find that this class (although perhaps a little funny-looking on the inside) really simplifies things. it also doesn't "reinvent the wheel" because there is no other open source class like it. I have not seen the EE moblog class, but that's because it's not included with the free version of EE..

try this out in a controller after dropping the file named imap_pop.php into the libraries dir:
// settings for gmail, you must have
// SSL support compiled into PHP
// and turn on POP in gmail
$config['service_flags'] = '/pop3/ssl/novalidate-cert';
$msg_count = $this->imap_pop->connect_and_count($config);
$em = $this->imap_pop->grab_email_as_array(1);

I added this example to the imap_pop wiki page

EDIT... i added a simple example (no SSL required) to the wiki page.

[eluser]Sally D[/eluser]
sophistry that looks easy to understand I am not to lost I can see it working it is exactly what I wanted. Hey I do got the paid version of EE it's 1.4 and its pissing me off cause I lost my downloaded copy and I can't download it again with out paying for and update to my EE license and I am a little tight on cash

But back to the code in order for me to try it I need ssl I am using using ubuntu with a lamp install

I installed apache like this in ubuntu

sudo apt-get install apache2 php5 mysql-client mysql-server phpmyadmin libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql

with that simple command I had my server up and running now I need to I am assuming to some how compile my Apache server with ssl there is probably a simple command out there but untill then I can't try your code out so I can only read it and see how it works

I don't code for a living I am a storeroom clerk and I don't really know any programmers to keep me sharp you know its like any thing else if you take a rock out of the fire and leave it by it's self it is going to get cold.

I really want to try your code let me search on a way to compile Apache with ssl support get that working then create your library class and put in my library folder then auto load it I am just a few steps away.

Your a good programmer Its hard to find programmers in real life at least for me. I want to try your code give me a moment please to configure my server.

Thanks for all your help it was wonderful.

Sophistry, thanks for your code. I'd like to experiment a little bit with the mail server, but I'm getting a little confused... where exactly is the class "imap_pop3.php"?
I couldn't file it in the wiki.
Sure I'm missing something...

raymondm, no problem with SSL. the example with gmail needs SSL, but if you have access to a regular old POP server email account, you should be able to use the class with no SSL.

andrea, i've updated the name of the class to imap_pop and updated the wiki page to allow a zip file download (learning the wiki as i go!)

let me know.

[eluser]Sally D[/eluser]

I just started messing around with it on this Sunday morning these are the things I did so far

1) I am to install the imap function I did this in ubuntu like this: apt-get install php5-imap
and that was about it

2) I had to mess around with the arguments to the imap_open function it's a little cyptic at first the flags are the /pop3 part and the mailbox is the INBOX part. I had to isolate it into another file to understand that here is my test mail.php file

$mbox =  imap_open ("{}INBOX", "user", "pass")or die("can't connect: " . imap_last_error());

$err = imap_errors();
$messCount = null;
if($err[0] == 'Mailbox is empty')
            // keep the state
            echo 'Mailbox is empty';
        } else
                       $messCount = imap_num_msg($mbox);
                       echo "<pre>";
                       echo "</pre>";
                       echo "<hr />";
                        echo "<pre>";
                       echo "</pre>";

I got one question what is the imap functions that returns the attacthments so I can download them?

I am thinking of rewriting the class and leaving out a few things to make it really simple just for fun.

nice job. that's a good approach. if you only need the one function for moblogging to extract the attachments...

i don't know which imap function does the attachments - that's why i wrote the class so i could forget about all the weird stuff i didn't need! my class just takes every attachment and writes it to a directory of your choice.

so, you can see how it's done in the extract parts function in the class. the syntax is a little weird.

[quote author="CI andrea" date="1190382831"]Sophistry, thanks for your code. I'd like to experiment a little bit with the mail server, but I'm getting a little confused... where exactly is the class "imap_pop3.php"?
I couldn't file it in the wiki.
Sure I'm missing something...[/quote]
Try here

This thread is pretty interesting actually, gonna have to look into what this class can do!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.