使用 Flex 应用程序发送的电子邮件有延迟

发布于 2024-09-05 13:04:50 字数 3112 浏览 7 评论 0原文

我目前正在 Flex 中构建一个应用程序,它利用 SMTP Mailer 自动将电子邮件发送到当满足特定条件时用户。应用程序每 30 秒检查一次此情况。根据从数据库表返回的新记录来满足条件。

问题如下:

当条件首次满足时,电子邮件将毫无问题地发送给用户。

第二次满足条件时,电子邮件不会送达。在 smtp 日志中,传递尝试似乎在以下行中挂起:

354 Start mail input; end with <CRLF>.<CRLF>

smtp 日志中没有错误代码,但我确实从 SMTP Mailer 类跟踪以下事件:

[Event type="mailError" bubbles=false cancelable=false eventPhase=2]

当第三次满足条件时,上次满足条件时未发送的电子邮件以及本例的电子邮件现在已发送。

然后,这种模式会不断重复,下一封电子邮件不会发送,然后当再次满足条件时,会同时发送两封电子邮件。

使用的 smtp 服务器是内部网络上的 Windows 2003。电子邮件将发送到托管在交换服务器上的 Outlook 帐户,该服务器也在该内部网络上。

这是创建 SMTPMailer 对象的动作脚本代码:

public var testMail:SMTPMailer = null;

public function alertNotify()
{   
    Security.loadPolicyFile("crossdomain.xml"); 
    this.testMail = new SMTPMailer("myserver.ec.local",25); 
    this.testMail.addEventListener(SMTPEvent.MAIL_SENT, onEmailEvent);
    this.testMail.addEventListener(SMTPEvent.MAIL_ERROR, onEmailError);
    this.testMail.addEventListener(SMTPEvent.DISCONNECTED, onEmailConn);
    this.testMail.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onEmailError);
}

这是创建电子邮件正文并调用发送电子邮件的方法的代码:

public function alertUser(emailAC:ArrayCollection):void 
{
    var testStr:String = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body><TABLE border=\"1\"><TR><TH><b> Key </b></TH><TH><b> Location </b></TH><TH><b> Event Type </b></TH><TH><b> Comment  </b></TH><TH><b> Update Time  </b></TH></TR>";
    for each (var event:rEntity in emailAC) {
        testStr = testStr + "<TR><TD>" + event.key.toString() + "</TD><TD>" + event.xml.address.toString() + " " + [email protected]() + "</TD><TD>" + [email protected]() + "</TD><TD>" + [email protected]() + "</TD><TD>" + event.xml.attribute("update-time").toXMLString() + "</TD></TR>"; 
    }

    testStr = testStr + "</TABLE></body></html>";
    testMail.flush();
    testMail.sendHTMLMail("[email protected]","[email protected]","Event Notification",testStr);
}

真的不确定挂起的电子邮件在最终发送之前存储在哪里......任何

有关如何开始解决此问题的建议将不胜感激。

I'm currently building an application in Flex that utilizes SMTP Mailer to automatically send out emails to the user when a particular condition is satisfied. The application checks this condition every 30 seconds. The condition is satisfied based on new records being returned from a database table.

The problem is as follows:

When the condition is first satisfied, the email is delivered to the user with no issues.

The second time the condition is satisfied, the email is not delivered. In the smtp logs, the delivery attempt appears to get hung up on the following line:

354 Start mail input; end with <CRLF>.<CRLF>

No error codes are present in the smtp logs, but I do trace the following event from the SMTP Mailer class:

[Event type="mailError" bubbles=false cancelable=false eventPhase=2]

When the condition is satisfied a third time, the email that was not delivered when the condition was satisfied the previous time is now delivered, along with the email for this instance.

This pattern then repeats itself, with the next email not being sent followed by two emails being sent simulatneously when the condition is met again.

The smtp server being used is Windows 2003, on an internal network. The email is being sent to an outlook account hosted on an exchange server that is also on this internal network.

Here is the actionscript code that creates the SMTPMailer object:

public var testMail:SMTPMailer = null;

public function alertNotify()
{   
    Security.loadPolicyFile("crossdomain.xml"); 
    this.testMail = new SMTPMailer("myserver.ec.local",25); 
    this.testMail.addEventListener(SMTPEvent.MAIL_SENT, onEmailEvent);
    this.testMail.addEventListener(SMTPEvent.MAIL_ERROR, onEmailError);
    this.testMail.addEventListener(SMTPEvent.DISCONNECTED, onEmailConn);
    this.testMail.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onEmailError);
}

Here is the code that creates the email body and calls the method to send the email:

public function alertUser(emailAC:ArrayCollection):void 
{
    var testStr:String = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body><TABLE border=\"1\"><TR><TH><b> Key </b></TH><TH><b> Location </b></TH><TH><b> Event Type </b></TH><TH><b> Comment  </b></TH><TH><b> Update Time  </b></TH></TR>";
    for each (var event:rEntity in emailAC) {
        testStr = testStr + "<TR><TD>" + event.key.toString() + "</TD><TD>" + event.xml.address.toString() + " " + [email protected]() + "</TD><TD>" + [email protected]() + "</TD><TD>" + [email protected]() + "</TD><TD>" + event.xml.attribute("update-time").toXMLString() + "</TD></TR>"; 
    }

    testStr = testStr + "</TABLE></body></html>";
    testMail.flush();
    testMail.sendHTMLMail("[email protected]","[email protected]","Event Notification",testStr);
}

Really not sure where the email that gets hung up is being stored until it is finally sent....

Any suggestions as to how to begin to remedy this issue would be much appreciated.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文