Airxmail、SMTP 和 crossdomain.xml 混淆

发布于 2024-11-09 19:32:17 字数 1858 浏览 0 评论 0原文

我创建了一个 Flex 应用程序,它使用 Coltware 的 airxmail 发送 SMTP 消息。它调用本地托管的 SMTP 服务器 (hmailserver),该服务器根据需要转发电子邮件。当在 Flash Builder 环境中运行时,一切都会按预期运行。我还可以使用 telnet 从 SMTP 服务器本地和远程发送电子邮件,因此我知道这不是服务器的问题。

当托管在 GUI 之外的电子邮件服务器框本身上时,应用程序无法发送电子邮件。我创建了一个 crossdomain.xml 文件来允许此访问,但我不认为它配置正确。

Flex 代码:

  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,"[email protected]");
  sender.setParameter(SMTPSender.PASSWORD,"password");


  var message:MimeMessage = new MimeMessage();
  message.contentType = ContentType.MULTIPART_ALTERNATIVE;
  var from:INetAddress = new INetAddress("[email protected]","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();

当我为各种 SMTPEvent 添加侦听器时,它们都不会触发。我认为这是由于 crossdomain.xml 文件中缺乏权限或配置不当造成的,该文件设置为:

<?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 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 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,"[email protected]");
  sender.setParameter(SMTPSender.PASSWORD,"password");


  var message:MimeMessage = new MimeMessage();
  message.contentType = ContentType.MULTIPART_ALTERNATIVE;
  var from:INetAddress = new INetAddress("[email protected]","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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫瑟鸿黎 2024-11-16 19:32:17

本地托管?如果您不使用“localhost”或“127.0.0.1”,则该主机不是本地托管的。在我看来,您正在尝试连接到网络中的服务器,但不是运行 Air 应用程序的计算机。

我相当确定 STMP 发送方正在使用套接字连接到服务器,所以我认为您需要做的是加载手册 套接字策略文件,但我不是 100% 确定。您可能想尝试完全打开跨域文件(通过使用“*”代替)。是否出现任何错误或无法连接?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文