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

时间:2010-06-10 18:46:25

标签: flex actionscript-3 email smtp delayed-execution

我目前正在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。电子邮件将发送到托管在此内部网络上的Exchange服务器上的Outlook帐户。

以下是创建SMTPMailer对象的actionscript代码:

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() + " " + event.xml.@municipality.toString() + "</TD><TD>" + event.xml.@type.toString() + "</TD><TD>" + event.xml.@comment.toString() + "</TD><TD>" + event.xml.attribute("update-time").toXMLString() + "</TD></TR>"; 
    }

    testStr = testStr + "</TABLE></body></html>";
    testMail.flush();
    testMail.sendHTMLMail("r@ec.ca","w@ec.ca","Event Notification",testStr);
}

真的不确定挂起的电子邮件在最终发送之前的存储位置....

非常感谢有关如何开始解决此问题的任何建议。

0 个答案:

没有答案