I've discovered a bug in the 4D Internet Commands SMTP methods. If the message 
subject contains the text "changed by", there won't be any errors returned but 
the e-mail will not be sent.

I've tested it on the following versions, all running on macOS 10.13.6
   * 4D 16.3HF4 64-bit, 4D Internet Commands 16.3 build 16.224100
   * 4D 16.4 64-bit build 16.226553, 4D Internet Commands 16.4 build 16.226553
   * 4D 16.4 32-bit build 16.226553, 4D Internet Commands 16.4 build 16.226553
   * 4D 17.0 build 17.225365

I've also tested it running under Windows server.

I've tested it on different machines, using different SMTP servers, on 
different networks. Same result. I find it hard to believe that having "changed 
by" in the message subject would cause the e-mail to not be sent, but my 
testing shows otherwise. Still, I've enclosed a small method below, and I'd 
appreciate it if others could try it out and let everyone know the result 
(you'll need to set the variables for the STMP server, addresses, and 
username/password if your SMTP server needs authentication).

This is a weird one. I'm assuming it's caused by some old debugging code that 
was left in place, but who knows.

Thanks,
Ben Kershaw


C_TEXT($tSMTPServer;$tEMailFrom;$tEMailTo;$tUserName;$tPassword)
C_LONGINT($lSMTPServerPort;$lMessageID;$lError;$lArrayElement)

$tSMTPServer:=""
$lSMTPServerPort:=25
$tUserName:=""
$tPassword:=""

$tEMailFrom:=""
$tEMailTo:=""

ARRAY TEXT($atSubject;0)
APPEND TO ARRAY($atSubject;"Valid subject")  //This will work fine
APPEND TO ARRAY($atSubject;"Invalid subject containing changed by")  //This 
won't return an error, but the e-mail won't be sent

For ($lArrayElement;1;Size of array($atSubject))
        $lMessageID:=0
        $lError:=SMTP_New ($lMessageID)
        $lError:=SMTP_Host ($lMessageID;$tSMTPServer)
        $lError:=SMTP_From ($lMessageID;$tEMailFrom)
        $lError:=SMTP_Subject ($lMessageID;$atSubject{$lArrayElement})
        $lError:=SMTP_Body ($lMessageID;"This is the message body";2)
        $lError:=SMTP_To ($lMessageID;$tEMailTo)
        If ($lSMTPServerPort#25)
                $lError:=IT_SetPort (2;$lSMTPServerPort)
        End if 
        If ($tUserName#"")
                $lError:=SMTP_Auth ($lMessageID;$tUserName;$tPassword)
        End if 
        $lError:=SMTP_Send ($lMessageID)
        $lError:=SMTP_Clear ($lMessageID)
End for 
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to