使用 Flex 应用程序发送的电子邮件有延迟
我目前正在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论