Posts Tagged ‘imap4’

I released airxmail version 0.7.

New feature

IMAP4

If you use draft implementation, please change this version.

google code download

I made airxmail swc file on google codes.
The file is draft implemetation version for IMAP4.
So if you don’t want to use draft version, please wait…

It doen’t support IMAP4 all functions.
But it is available to get e-mail message from imap server, like gmail imap.

These code are sample to connect and get message from gmail account.

Create client instance
import com.coltware.airxmail.imap.IMAP4Client;
:

private var client:IMAP4Client;

public function init():void{

	client = new IMAP4Client;
	client.host = "imap.gmail.com";
	client.port = 993;
	client.socketObject = new SecureSocket();
}
mail flow to connect and get e-mail
//  Set handler for Folder Result
client.addEventListener(IMAP4Event.IMAP4_FOLDER_RESULT,folderListResult);

//  Set handler for UID list result ( uid is a key to get e-mail from server )
client.addEventListener(IMAP4ListEvent.IMAP4_RESULT_UID_LIST,uidList);

//  Set message handler 
client.addEventListener(IMAP4MessageEvent.IMAP4_MESSAGE,handleMessage);

//  Set username and password, and invoked connect method
client.setAuth(username,password);  
client.connect();
client.login();

//  get subscribed folder list
client.lsubBlocking();

// logout 
client.logout();
Implemantation of folder result handler
private function folderListResult(event:IMAP4Event):void{
  var folder:IMAP4Folder = event.result as IMAP4Folder;
  trace("NAME=>[" + folder.name + " --> " + folder.nameUTF8 + "]");
  if(!folder.noselect){
    client.selectMailbox(folder).search(IMAP4Search.dateSentSince("2010/10/01"));
  }
}

POINT1

if(!folder.noselect){
	
}

If the folder’s noselect property is true, you can NOT select mailbox,

POINT2

client.selectMailbox(folder).search(IMAP4Search.dateSentSince("2010/10/01"));

If you want to get ALL messages from the folder,

client.selectMailbox(folder).search(IMAP4Search.ALL);

If you know the folder name ( ex “INBOX” ) and want to get ALL messages form the folder,
you don’t need to get folder list, so you can change main flow source as following below..

:
client.login();

// client.lsubBlocking();
client.selectMailbox("INBOX").search(IMAP4Search.ALL);
client.logout();
Implemantation of message get handler

// result for search method
private function uidList(event:IMAP4ListEvent):void{
for(var i:int = 0; i

RSS
Add to Google
2017年5月
« 2月    
 123456
78910111213
14151617181920
21222324252627
28293031