开发者

Airxmail, SMTP, and crossdomain.xml Confusion

I've created a Flex app which uses Coltware's airxmail to send SMTP messages. It calls a locally-hosted SMTP server (hmailserver), which relays the email out as appropriate. When run within the Flash Builder environment, everything works as intended. I can also send email both locally and remotely from the SMTP server using telnet, so I know that it's not a problem with the server.

When hosted on the email server box itself, outside of the 开发者_Python百科GUI, the app fails to send email. I've created a crossdomain.xml file to allow this access, but I don't believe it's configured properly.

The Flex code:

  sender = new SMTPSender();
  sender.setParameter(SMTPSender.HOST,"192.168.10.10");
  sender.setParameter(SMTPSender.PORT,25);  
  sender.setParameter(SMTPSender.AUTH,true);
  sender.setParameter(SMTPSender.USERNAME,"emailuser@domain.com");
  sender.setParameter(SMTPSender.PASSWORD,"password");


  var message:MimeMessage = new MimeMessage();
  message.contentType = ContentType.MULTIPART_ALTERNATIVE;
  var from:INetAddress = new INetAddress("emailuser@server.com","Fake Name");

  message.setFrom(from);
  var toRecpt:INetAddress = new INetAddress(email,username);
  message.addRcpt(RecipientType.TO,toRecpt);

  message.setSubject(subject);


  var partHtml:MimeTextPart = message.createTextPart();
  partHtml.setHtmlText(body);

  sender.send(message);           
  sender.close();

When I add listeners for the various SMTPEvents, none of them fire. I think this is due to a lack of permissions or poor configuration within the crossdomain.xml file, which is set up as:

<?xml version="1.0" ?> 
  <!DOCTYPE cross-domain-policy (View Source for full doctype...)> 
- <cross-domain-policy>
  <allow-access-from domain="192.168.10.10" to-ports="25" secure="true" /> 
  <allow-access-to domain="192.168.10.10" secure="false" /> 

  </cross-domain-policy>

I've found a number of questions like this, but few posted answers. I'm convinced it's something obvious. Any ideas as to how I can proceed?

Thanks!


Locally hosted? if you're not using 'localhost' or '127.0.0.1', that is not locally hosted. Seems to me you're trying to connect to a server within your network, but not on the machine running the Air application.

I'm fairly sure that the STMP sender is using Sockets to connect to the server, so I think what you need to do is load a manual socket policy file, but I'm not 100% sure. You might want to try to get the crossdomain file completely open (by using '*' instead). Are there any errors that pop up or it just doesn't connect?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜