1

Topic: fetching mail with php

==== Required information ====
- iRedMail version: 0.8.1
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: CentOS 6
- Related log if you're reporting an issue:
====

Hi.

I want to be able to retrieve mails with a php script (for support panel) but i'm having a hard time getting it to work with iredmail.

it goes wrong in the part where it is supposed to go to inbox

Error: Unable to access mail: Can't open mailbox {mailserver:port:}: invalid remote specification[
(mailserver:port stands instead of actual info)


Code:
---------------------------------------------------------------------------
$hostname = '{'.imapserver.':'.imapport.':'.imapauth.'}';

$parse=array();
$deletemail=false;
$inbox = imap_open($hostname, imapuser, imappw) or die('Unable to access mail: ' . imap_last_error());
$emails = imap_search($inbox,'UNSEEN');

if($emails) {



Could someone help out modifying this code to make it work ? smile

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: fetching mail with php

With iRedMail-0.8.1 default settings, you have to access IMAP/POP3 services over TLS. So please update your PHP script to make it work with IMAP/POP3 over TLS (recommended), or allow to access without TLS (not recommended) by following this tutorial:
http://www.iredmail.org/wiki/index.php? … t.STARTTLS

3 (edited by wezon 2012-08-12 23:36:13)

Re: fetching mail with php

Ah, right.

changed to ssl 993 and all works like clockwork.

thanks for the heads up