CodeIgniter Forums
imap_pop , array problem . - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: imap_pop , array problem . (/showthread.php?tid=12017)



imap_pop , array problem . - El Forum - 10-02-2008

[eluser]nebi[/eluser]
Hi!

I am using the imap_pop lib and using the example from the wiki and made a small modify


Code:
$this->load->library('imap_pop');
// this is your pop server host and domain name
$config['server']='xxx:110';
$config['login']='xxx';
$config['pass']='xxxx';
// you may have to look up the imap functions at PHP.net
// to get the right set of service flags here
$config['service_flags'] = '/pop3/notls';
$config['mailbox']= 'INBOX';
$msg_count = $this->imap_pop->connect_and_count($config);
$em = $this->imap_pop->grab_email_as_array(1);
$this->imap_pop->close();
//print_r($em);
$this->load->view('email_view', $em);

email_view.php :

Code:
<html>
<head><title>EMAIL</title></head>
<body>

<?=$text?>

</body>
</html>


Error code :
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: text

Filename: views/email_view.php

Line Number: 5

I trying to get the messasage text from the mail from the array but no luck .


imap_pop , array problem . - El Forum - 10-02-2008

[eluser]acoda[/eluser]
Hi nebi,

Had a quick look at this for you and if you change your view file to this:
Code:
<html>
<head><title>EMAIL</title></head>
<body>

<?=$strings['text']?>

</body>
</html>

You should see the massage text from your e-mail. You just miss read the array and referenced it wrong, easily done.


imap_pop , array problem . - El Forum - 10-03-2008

[eluser]nebi[/eluser]
Thanks acoda , it works great!