At some point SMTP stopped being reliable

2009 SP1. I'm sending emails during the night from NAS with SMTP codeunit. Since July/Aug it stopped being reliable. 80% of the cases it works, 20% of the cases I get an SMTP error message, transport failed to connect to server (not an authentication issue since the same auth usually works) or a the automation variable has not been instantiated message ( again not a programming issue, because the same code usually works).

Since this change happened from one day to another and no change in Navision I suspect it was some Exchange or Windows update?

Exchange log says when it does not work it does not even try to connect.

I think - not sure - the second error is dependent on the first, then SMTP Automation is trying to connect, is busy, and thus when another code is calling it is too busy and cannot instantiate. I think.

Any ideas what it could be or what chould I check?

Would it help to use the new version of the Automation? You know from the 2009 R2 where you can also set the port. Standard port 25 is OK for me but I just think it is a new version maybe better. If yes, can you remind me how do I do this regasm and GacUtil thing?

Answers

  • mdPartnerNLmdPartnerNL Member Posts: 802
    Saurav has a download on his blog about the new dll: https://onedrive.live.com/?id=145E2738BACE1FB2!409&cid=145E2738BACE1FB2
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Is that probable that the problem is the old DLL?
  • mdPartnerNLmdPartnerNL Member Posts: 802
    don't think so, I would use a simple local smtp server that accepts the message from NAV and relays/sends out the messages. At least you can eliminate the problem better.
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    We tried a different e-mail server with different results, no error message but some reports just silently fail, and not even too big ones. Meanwhile, everything I send from later versions of Navision which use .NET SMPT work well. The problem is with the OCX clearly. Which I upgraded to the later version that can use ports, no avail.

    Are there any other OCXes out there? Trying to get Dimac Jmail now.


    I am also trying to use built-in objects, and the following code fails here:

    objEmail.Configuration := objEmailConf;

    "could not load the selected library"
    
    NewCDOMessage(ToName : Text[1024];Subject : Text[1024];Body : Text[1024];AttachFileName : Text[1024])
    // recSetup -- a table with SMTP fields
    // objEmailConf -- 'Microsoft CDO For Exchange 2000 Library'.Configuration
    // objEmail -- 'Microsoft CDO For Exchange 2000 Library'.Message
    // flds -- 'Microsoft ActiveX Data Objects 2.5 Library'.Fields
    // fld -- 'Microsoft ActiveX Data Objects 2.5 Library'.Field
    
    recSetup.GET;
    recSetup.TESTFIELD("SMTP Server");
    recSetup.TESTFIELD(Port);
    IF ISCLEAR(objEmailConf) THEN
      CREATE(objEmailConf);
    
    flds := objEmailConf.Fields;
    
    fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver');
    fld.Value(recSetup."SMTP Server");
    
    fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserverport');
    fld.Value(recSetup.Port);
    
    fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/sendusing');
    fld.Value(2);
    
    flds.Update();
    
    IF ISCLEAR(objEmail) THEN CREATE(objEmail);
    
    //objEmail.Configuration := objEmailConf;
    
    //objEmail.From := recSetup."E-Mail From";
    objEmail."To" := ToName;
    objEmail.Subject := Subject;
    
    IF Body <> '' THEN
      objEmail.TextBody := Body;
    IF AttachFileName <> '' THEN
    BEGIN
      objEmail.AddAttachment(AttachFileName);
      IF Body='' THEN
        objEmail.TextBody :=' ';
    END;
    
    objEmail.Send;
    
    
Sign In or Register to comment.