Can’t get email from POP3 or IMAP4 server with Airxmail.
Can’t send email to SMTP server with Airxmail.
But Why ?

But It is difficult to make the answer.
Because Airxmail is a library to communicate servers.
So you should know which is the problem, server or client ?

But How ??

Airxmail library support flex logging(mx.logging) functions.
So you can get debug logs using this functions.
The log text show you the communication between server and client.

1.Log sample ( IMAP and POP3 )
2.How to use flex logging functions.
  2-1 ) Output using standard( trace() ) classes.
  2-2 ) Output to file instead of trace()

Log sample


com.coltware.airxmail.imap.IMAP4Client set auth :
com.coltware.airxmail_internal.IMAP4 CMD[AX1000 CAPABILITY]
com.coltware.airxmail_internal.IMAP4 CMD[AX1001 LOGIN username password]
com.coltware.airxmail_internal.IMAP4 CMD[AX1002 NAMESPACE]
com.coltware.airxmail_internal.IMAP4 CMD[AX1003 LSUB "" "*"]
com.coltware.airxmail_internal.IMAP4 CMD[AX1004 SELECT "INBOX"]
com.coltware.airxmail.imap.command.SelectCommand OK...
com.coltware.airxmail_internal.IMAP4 CMD[AX1005 UID SEARCH SENTSINCE 1-Nov-2010]
com.coltware.airxmail.imap.command.IMAP4Command line>* SEARCH  237 238 239 240 241
com.coltware.airxmail_internal.IMAP4 CMD[AX1006 UID FETCH 241 RFC822.HEADER]
com.coltware.airxmail.MimeBodyPart create part object : [xxxx][object MimeMessage]
com.coltware.airxmail_internal.IMAP4 CMD[AX1007 UID FETCH 240 RFC822.HEADER]
com.coltware.airxmail.MimeBodyPart create part object : [xxxx][object MimeMessage]
com.coltware.airxmail_internal.IMAP4 CMD[AX1008 UID FETCH 239 RFC822.HEADER]
com.coltware.airxmail_internal.IMAP4 CMD[AX1051 SELECT "&TtVOiw-"]
com.coltware.airxmail_internal.IMAP4 CMD[AX1052 SELECT "&ZcWITA-"]
com.coltware.airxmail_internal.IMAP4 CMD[AX1053 LOGOUT]

“com.coltware.airxmail_internal.IMAP4 CMD[AXxxxx” is a request.


com.coltware.airxmail.pop3.POP3Client handleNotServiceReady :
com.coltware.airxmail.pop3.POP3Client [NO] +OK POP Gateway starting. <>
com.coltware.airxmail.pop3.POP3Client exec[USER username]
com.coltware.airxmail.pop3.POP3Client USER>+OK Password required for
com.coltware.airxmail.pop3.POP3Client exec[PASS xxxxxxx]
com.coltware.airxmail.pop3.POP3Client PASS>+OK 8 message(s) (45468 octets).
com.coltware.airxmail.pop3.POP3Client exec[UIDL]
com.coltware.airxmail.pop3.POP3Client UIDL>+OK uidl command accepted.
com.coltware.airxmail.pop3.POP3Client UIDL>1 798898888666525F84ZX55365F999671U
com.coltware.airxmail.pop3.POP3Client UIDL>2 798898888278645F84ZX54365F99986YX
com.coltware.airxmail.pop3.POP3Client UIDL>3 798898868173705F84ZX5Z365F99930YZ
com.coltware.airxmail.pop3.POP3Client UIDL>4 798898858076435F84ZX52365F999679W
com.coltware.airxmail.pop3.POP3Client UIDL>5 798898857787865F84ZX54365F99978Z4
com.coltware.airxmail.pop3.POP3Client UIDL>6 798898828171545F84ZX54365F9996X0Z
com.coltware.airxmail.pop3.POP3Client UIDL>7 798898808643695F84ZX51365F9994ZUX
com.coltware.airxmail.pop3.POP3Client UIDL>8 798898798097665F84ZX5V365F9998X3V
com.coltware.airxmail.pop3.POP3Client UIDL>.
com.coltware.airxmail.pop3.POP3Client exec[TOP 8 0]
com.coltware.airxmail.pop3.POP3Client [RETR]+OK 3082 octets
com.coltware.airxmail.pop3.POP3Client exec[QUIT]
2.How to use flex logging functions

Flex logging function is not depends output facility.
So you can decide the log output facility.
1st step: explain how to use flex logging using the class in FLEX SDK ( not depends on any library to output log )
2nd step: explain how to write log file using my classes
Because standard classes in FLEX SDK in only support standard output(?) ( trace() output ) as far as I know.

2-1 )

import mx.logging.Log;
import mx.logging.LogEventLevel;
import mx.logging.LogLogger;
import mx.logging.targets.TraceTarget;

private function init():void{
	var logTarget:TraceTarget = new TraceTarget();
	logTarget.filters = ["*"];
	logTarget.includeCategory = true;
	logTarget.level = LogEventLevel.DEBUG;

Please invoke init method in your initialize step.
In my usual case, I write these code.

<mx:WindowedApplication xmlns:mx="" width="100%" height="100%" xmlns:local="*"

That’s all.
You don’t need to write stace() function in your code.

You can see these code in airxmail library.

private static const log:ILogger = Log.getLogger("com.coltware.airxmail.imap.IMAP4Client");
private static const _log:ILogger = Log.getLogger("com.coltware.airxmail_internal.IMAP4");
_log.debug("CMD[" + cmd + "]");

Airxmail output a log automatically using flex logging functions.
You can see more detail at
Flex logging function is many functions , like filter output and change output format etc …

Current Airxmail subversion repository version has these 2 category.

“com.coltware.airxmail_internal.*” is low level log like protocol debug.
“com.coltware.airxmail.*” is more user level log.
But there was not clearly border, so please check the source code if you want to know more detail.

2-2 )
use FileTarget class in airxlib library.
FileTarget class support to write log file on your desktop pc.

import com.coltware.airxlib.log.FileTarget;

private function init():void{

  var fileTarget:FileTarget = new FileTarget(); = File.desktopDirectory;  //  set directory path
  fileTarget.filename = "airxmail.log";              //  set filename
  fileTarget.append = false;                             
  fileTarget.filters = ["*"];
  fileTarget.includeCategory = true;
  fileTarget.level = LogEventLevel.DEBUG;

Related Posts

11 Responses to “airxmail: How to know the communication between server and Airxmail.”

  • Jesus より:

    Hi Coltware!

    I’m using your aixmail libreary and I’m having one issue I really don’t know how to track or even why is it happening. It’s related with pop3.
    Everything works fine, connecting, authenticating, getting messages.. everything seems to work fine.
    But sometimes, when getting messages, something happens with some messages and it stops getting that message and, as this current job is not fihisned, any other queued jobs are not processed.
    The most strange part is that it happens always on the same message on the same line when receiving. If I delete that message, it continues getting messages fine until I reach another strange message, then it fails always at that point.

    I’ve made some debug and I’ve seen that when this happens, POP3Client->handleData does not receive data anymore, always on the same message at the same point and current message is never finished.

    Something like this, there is a trace every “handleData” call and every line on buffer is read, something like this:

    LINE: MIME-Version: 1.0
    LINE: X-mailer:
    LINE: Received: from website with Incrowd MCCIT
    LINE: Content-Type: multipart/alternative; boundary=”incrowd_650732e6636163656626f7892e636f26d04cdb07″
    LINE: Message-Id:
    LINE: Date: Sun, 28 Jan 2007 07:05:04 +0100 (CET)
    LINE: This is a multi-part message in MIME format.
    LINE: –incrowd_650732e6636163656626f7892e636f26d04cdb07
    LINE: Content-Type: text/plain; charset=ISO-8859-1
    LINE: Content-Transfer-Encoding: 7bit
    LINE: Hola,

    At the end it gets some “empty” RETR commands and that’s all, no more data, and at this point, it stops getting data anymore.
    Any idea about what could be happening or why?
    I’ve tested it with several servers and it’s always there, gmail, hotmail, private qmail server…

  • coltware より:

    Hi Jesus

    Maybe I think airxmail has mime message parse bug.
    But I am not sure…

    Could you check that airxmail can parse the e-mail (eml file)
    (Please save e-mail as eml file on your desktop not using airxmail)

    Or please send me the e-mail.


  • Jesus より:

    Hi Coltware,

    Sorry for the delay.
    How can I sent you the email? Where do you want it?

  • coltware より:

    Hi Jesus

    I got your eml file.
    Thank you.

    I’ll check it.
    Please wait a few days.

  • coltware より:

    Hi Jesus.

    I tested my gmail pop3 server.
    But I can get all message data.

    > Maybe I think airxmail has mime message parse bug.
    That is my miss-understand.

    > At the end it gets some “empty” RETR commands and that’s all,

    How do you use airxmail api to get e-mail from pop3 server ?

    The following code is that I tested this time.

    package com.coltware.airxmail.samples
    import com.coltware.airxmail.MimeBinaryPart;
    import com.coltware.airxmail.MimeMessage;
    import com.coltware.airxmail.pop3.POP3Client;
    import com.coltware.airxmail.pop3.POP3Event;
    import com.coltware.airxmail.pop3.POP3ListEvent;
    import com.coltware.airxmail.pop3.POP3MessageEvent;
    import com.hurlant.crypto.tls.TLSSocket;

    import flash.filesystem.File;
    import flash.filesystem.FileMode;
    import flash.filesystem.FileStream;
    import flash.utils.ByteArray;

    import mx.logging.ILogger;
    import mx.logging.Log;

    public class POP3MaildirSample
    private static const log:ILogger = Log.getLogger("POP3MaildirSample");

    private var client:POP3Client;

    public function POP3MaildirSample()
    client = new POP3Client(); = '';
    client.port = 995;
    client.socketObject = new TLSSocket();

    private function _auth_ok(event:POP3Event):void{
    log.debug("auth ok..");

    private function _list(event:POP3ListEvent):void{
    for(var i:int=0; i" + msg.subjectUTF8);
    if(msg.uid == 'GmailId1389f99202daac70'){
    var children:Array = msg.attachmentChildren;
    log.debug("size :[" + children.length + "]");
    if(children.length == 1){
    var mimeBinPart:MimeBinaryPart = children[0] as MimeBinaryPart;
    log.debug("bin part ...!!" + mimeBinPart.contentDisposition);
    var bytes:ByteArray = mimeBinPart.bodyByteArray;
    var file:File = File.desktopDirectory.resolvePath("sample.gif");
    var fs:FileStream = new FileStream();,FileMode.WRITE);

    public function quit():void{

  • coltware より:

    Hi Jesus

    I found pop3 error handling bug and I fixed today.

    So please use svn version.
    And please check server returns error message or not.

    private function _command_ng(event:POP3Event):void{“command error: ” + event.message);

  • jesus より:

    Thankyou coltware, I’ll try to test during this weekend. Let you know ASAP.

  • jesus より:

    Hi Coltware!
    It’s still failling, but i think I have the issue, but not sure about the solution.
    Try this new email:

    I have also made your test:

    var file:File = new File(File.applicationDirectory.nativePath+”/kk.eml”);
    var fs:FileStream = new FileStream();,FileMode.READ);
    var parser:MailParser = new MailParser();
    var msg:MimeMessage = parser.parseStream(fs);
    var text:String = msg.bodyText;

    And it fails when reading this line:

    Subject: Recordatorio: CARLOS LÓPEZ MÉNDEZ quiere ser tu amigo

    IT’s about acent chars.
    In StringLineReader you have:

    public function next(charset:String = “utf-8”):String{
    var bytes:ByteArray = nextBytes();
    if(bytes == null){
    return “”;
    bytes.position = 0;
    return bytes.readMultiByte(bytes.bytesAvailable,charset);

    Which is trying to convert chars to UTF-8 and that’s what is failling.
    If I force it to:
    public function next(charset:String = “iso-8859-1”)

    It works!
    But I don’t know if it will fail with other charsets.
    I don’t know what is the standard charset when retrieving emails in pop3 protocol.

    What do you think? What could be the solution?


  • jesus より:

    Also, if I change



    return bytes.readUTFBytes(bytes.bytesAvailable);

    What do you think Coltware?

  • coltware より:

    Thanks jesus.

    I changed “StringReader” class on google svn ( airxlib svn repository )
    please see

    I thought readMultiByte(‘utf-8’) is same as readUTFBytes();
    But it was not same..

    So I changed if charset is ‘utf-8’ ( or null), use readUTFBytes()..

    Please try it.

  • jesus より:

    I’ll make some tests and let you know.

Leave a Reply

Spam protection by WP Captcha-Free

Add to Google
« 12月   2月 »