Posts Tagged ‘html’

You have to care 2 type of content type if you want to get html part of e-mail message.

1 ) text/html
2 ) multipart/alternative

1 ) text/html

In this case, you can get html content very easily.
The mime message only has one body part.

private function handleMessage(event:IMessageEvent):void{
  var msg:MimeMessage = event.getMimeMessage();
  var htmlText:String = msg.bodyText;
}
2 ) multipart/alternative

This case is slightly harder than case 1.
But airxmail support to access to child part using findParts method.

var parts:Array = msg.findParts("text/html");
  if(parts.length > 0){
    var htmlText:String = MimeBodyPart(parts[0]).bodyText;
  }
}

Typically, text/html part is the only one.
So I think you don’t need to check first text/html part.

see source code

MimeMessage.findPart

RSS
Add to Google
2017年1月
« 2月    
1234567
891011121314
15161718192021
22232425262728
293031