PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Ken Sproul on May 12, 2021, 08:16:19 PM

Title: *web/email error message (0/117)
Post by: Ken Sproul on May 12, 2021, 08:16:19 PM
I'm having trouble with *web/email returning an error 0 with the following message:
Sending to SMTP Server Failed: (0): Connect to SMTP Server: server-name;25 timed out. (0/117).

Pxplus Version: 15.10
Windows Version: Windows Server 2012 R2 Standard


I can open "[tcp]server-name;25" with no error.  I can write smtp commands to the channel to send an email.  I can use *web/mail to send an email with no error.


This same server has an older version of PxPlus and *web/email works fine with the older version.


I checked permissions in the pvx and lib directories and don't see any issues, although I cannot rule it out.


What is *web/email trying to do (assuming at line 117) that is resulting in a busy error?

New info.  The server is a local smtp server on port 25 without user authentication.  So I changed the server to "smtp.gmail.com;465-secure;username;password" using my own username/password and it worked without an error.  Hopefully this is a clue.

Title: Re: *web/email error message (0/117)
Post by: ChrisKCAi on May 12, 2021, 09:41:49 PM
I'd like to add a "me too". Windows 2016 server; PxPlus V16.20 but same symptom. Local SMTP server/port 25/no authentication - *web/email works fine in V10.20 but returns the 0/117 error when running in V16.20
Title: Re: *web/email error message (0/117)
Post by: Mike King on May 13, 2021, 11:23:26 AM
One thing that was added to *web/email with the more current version was its support of STARTTLS which, when it receives acknowledgement from the SMTP server that it supports TLS, causes *web/email (technically *web/smtp) to start a TLS/SSL connection.

Its possible that could be causing the problem -- perhaps your server requesting STARTTLS but not having a valid certificate for TLS use.

Also, did you check to see if there was any sort of error message returned in the errormsg$ argument of *web/email?




Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 13, 2021, 04:44:10 PM
Mike, thanks for the info.  This is the message received:
Sending to SMTP Server Failed: (0): Connect to SMTP Server: server-name;25 timed out. (0/117).
Title: Re: *web/email error message (0/117)
Post by: Mike King on May 13, 2021, 04:57:46 PM
Okay -- What is your timer set to in the call to *web/email?

Does increasing the timeout setting in the call increase the time before you get the error (technically the error we get from the OS is somewhat generic so our message that the issue is a timeout is best-guess of most common reason for the OS error condition returned).

Also if this is easily reproducible, you might try doing the send email while you have a trace file or trace window open.  The smtp interface has a number of trace messages in it that can help track its progress.
Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 13, 2021, 05:16:16 PM
Mike, there is no timeout specified and it takes 60 seconds to get the error.  I tried a timeout of 10 seconds and it errored in 10 seconds.  I'll see what happens with the trace window.
Title: Re: *web/email error message (0/117)
Post by: Mike King on May 13, 2021, 05:42:25 PM
Make sure your smtp server name and port is correct since it sounds like it cannot resolve the connection.

Also, are you running this as a service and if so do you know if the service has access to the internet.  Often services are prevented from accessing the Internet and you have to use a privileged user to run the service.  Try directly opening a connection to the port from the same server/service to see if it works.

Line 117 (again assuming this is the correct line) is simply an OPEN to the server specified with a timeout.
Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 13, 2021, 06:22:56 PM
Mike,


The error occurs in a foreground process.


I have successfully done this with no error:
open (1)"[tcp]server-name;25"


In addition, I have written smtp commands to the open channel to send an email.  Have also used *web/mail in a foreground process to successfully send the email.


It is only *web/email that produces the error.  I'll try the trace you suggested later.
Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 14, 2021, 05:28:50 PM
Mike, below are the trace results.  Hopefully it provides some clues for you.

Code: [Select]
0220 ok=0; call "*web/email",err=*next,from_addr$,"",to_addr$,"","","(*web/email) "+subject$,body$,"","",server$+";"+port$+tbl(nul(username$),";"+username$+";"+password$,""),timeout,-1,"",1,err_msg$,"",""; ok=1
[/size]Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@133 System errno=2
[/size]Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@134 System errno=2
[/size]Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@135 System errno=2
[/size]Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@136 System errno=2
[/size]Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@137 System errno=2
[/size]Open file(32767):F:\infor\facts93\pvx\lib\_web\webserv.mim   [Pgm=*web/email Stno=00147]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox\new   [Pgm=*web/email Stno=01047]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Close file(32766):*web/outbox/new   [Pgm=*web/email Stno=01047]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Error:26 Program=F:\infor\facts93\pvx\lib\_web\email@991 System errno=13
[/size]Tried to open F:\infor\facts93\pvx\lib\_web\outbox\new\24593497234628c40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\mods\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\mods\prog\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\prog\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\hotkeys\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\link\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\mods\prog\CS\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\prog\CS\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\prog\_w\_web\outbox\new\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Error:12 Program=F:\infor\facts93\pvx\lib\_web\email@996 System errno=2
[/size]Error:14 Program=F:\infor\facts93\pvx\lib\_web\email@1004 System errno=2
[/size]Error:26 Program=F:\infor\facts93\pvx\lib\_web\email@991 System errno=2
[/size]Tried to open F:\infor\facts93\pvx\lib\_web\outbox\24593497234628c40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\mods\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\mods\prog\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\prog\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\hotkeys\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\link\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\mods\prog\CS\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\prog\CS\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Tried to open F:\infor\facts93\prog\_w\_web\outbox\24593497234628C40175.eml and failed   [Pgm=*web/email Stno=00996]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Error:12 Program=F:\infor\facts93\pvx\lib\_web\email@996 System errno=2
[/size]Error:14 Program=F:\infor\facts93\pvx\lib\_web\email@1004 System errno=2
[/size]Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox\new\24593497234628c40175.eml   [Pgm=*web/email Stno=00534]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00565]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00566]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00578]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00579]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00586]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00602]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00605]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00606]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00612]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00613]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00614]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00629]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *web/outbox/new/24593497234628C40175.eml (32766)    [Pgm=*web/email Stno=00653]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Close file(32766):*web/outbox/new/24593497234628C40175.eml   [Pgm=*web/email Stno=00840]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox   [Pgm=*web/smtp Stno=00523]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Close file(32766):*web/outbox   [Pgm=*web/smtp Stno=00527]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox\sent   [Pgm=*web/smtp Stno=00523]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Close file(32766):*web/outbox/sent   [Pgm=*web/smtp Stno=00527]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox\sent   [Pgm=*web/smtp Stno=00502]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Close file(32766):*web/outbox/sent   [Pgm=*web/smtp Stno=00507]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Open file(32766):*memory*   [Pgm=*web/smtp Stno=00081]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Open file(32765):F:\infor\facts93\pvx\lib\_web\outbox\new\24593497234628c40175.eml   [Pgm=*web/smtp Stno=00087]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Close file(32765):F:\infor\facts93\pvx\lib\_web\outbox\new\24593497234628c40175.eml   [Pgm=*web/smtp Stno=00092]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Write issued to *memory* (32766)    [Pgm=*web/smtp Stno=00094]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Open file(32765):[tcp];0   [Pgm=*web/smtp Stno=00351]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Close file(32765):[tcp];0   [Pgm=*web/smtp Stno=00354]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Error:0 Program=F:\infor\facts93\pvx\lib\_web\smtp@117 System errno=13
[/size]Close file(32766):*memory*   [Pgm=*web/smtp Stno=00316]<--[Pgm=*web/email Stno=00844]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Error:0 Program=F:\infor\facts93\pvx\lib\_web\email@844 System errno=13
[/size]Close file(32767):*web/webserv.mim   [Pgm=*web/email Stno=00901]<--[Pgm=TEST-EMAIL Stno=00220]
[/size]Error:0 Program=F:\infor\facts93\mods\TEST-EMAIL@220 System errno=2
Title: Re: *web/email error message (0/117)
Post by: Mike King on May 14, 2021, 05:53:23 PM
Sorry -- I should have asked you to also set %trace_email in Version 15.10 in order to get the trace output.

However looking at the trace I still think you have some form of firewall or permissions issue.

Have you tried issuing a call to *web/email manually and not just opening the port?

The program that fails, how is it run? 
Is it possibly running WindX and the call to *web/email is being done from the workstation?
How is the process that is issuing the call to *web/email running -- background as a service?  On the server but running as a service?

Now I also have some concerns about the first 5 lines with error 17's.  Those lines in *web/email are:

0133 ADDR "*web/email",ERR=*NEXT
0134 ADDR "*web/address",ERR=*NEXT
0135 ADDR "*web/base64",ERR=*NEXT
0136 ADDR "*web/qprint",ERR=*NEXT
0137 ADDR "*web/smtp",ERR=*NEXT

Something is off if those lines get error 17 -- this should only happen if the files and not programs but something else like a text file which you cannot ADDR.

Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 14, 2021, 06:09:45 PM
Below is the test program followed by the new trace and the screen output (server and email addresses changed to protect the innocent).


Code: [Select]
0010 ! test-email
0020 begin
0030 try_mail=0
0040 server$="server-name",port$="25",timeout=10
0050 username$="",password$=""
0060 from_addr$="facts@xxx.com"
0070 to_addr$="ken@dpiserve.com"
0080 subject$="Test Subject"
0090 body$="Test message."
0100 body$+=$0D0A0D0A$+"Server: "+server$+$0D0A$+"Port: "+port$
0110 if len(username$) then body$+=$0D0A$+"User: "+username$+tbl(nul(password$)," / "+dim(len(password$),"*"),"")
0120 print "Email Test",'LF',"=========="
0130 print "Server:",@(15),server$
0140 print "Port:",@(15),port$
0150 print "User:",@(15),username$,tbl(nul(password$)," / "+dim(len(password$),"*"),"")
0160 print "Timeout: ",@(15),str(timeout)
0170 print "From: ",@(15),from_addr$
0180 print "To: ",@(15),to_addr$
0190 print 'LF',"Subject: ",'LF',subject$
0200 print 'LF',"Body:",'LF',body$
0210 print 'LF',"Calling *web/email"; wait 0
0220 ok=0; call "*web/email",err=*next,from_addr$,"",to_addr$,"","","(*web/email) "+subject$,body$,"","",server$+";"+port$+tbl(nul(username$),";"+username$+";"+password$,""),timeout,-1,"",1,err_msg$,"",""; ok=1
0230 print 'LF',"Result:",'LF',tbl(ok,err_msg$,"Email sent.")
0240 if try_mail and not(ok) then {
0250 print 'LF',"Calling *web/mail"; wait 0
0260 ok=0; call "*web/mail",err=*next,server$+";"+port$,(from_addr$),(to_addr$),"(*web/mail) "+subject$,(body$),err_msg$; ok=1
0270 print 'LF',"Result:",'LF',tbl(ok,err_msg$,"Email sent.")
0280  }
0290 end


Trace with %trace_email=1

F:\infor\facts93\mods\TEST-EMAIL
 0010 ! test-email
 0020 begin
 0030 try_mail=0
 0040 server$="server-name",port$="25",timeout=10
 0050 username$="",password$=""
 0060 from_addr$="facts@xxx.com"
 0070 to_addr$="ken@dpiserve.com"
 0080 subject$="Test Subject"
 0090 body$="Test message."
 0100 body$+=$0D0A0D0A$+"Server: "+server$+$0D0A$+"Port: "+port$
 0110 if len(username$) then body$+=$0D0A$+"User: "+username$+tbl(nul(password$)," / "+dim(len(password$),"*"),"")
 0120 print "Email Test",'LF',"=========="
 0130 print "Server:",@(15),server$
 0140 print "Port:",@(15),port$
 0150 print "User:",@(15),username$,tbl(nul(password$)," / "+dim(len(password$),"*"),"")
 0160 print "Timeout: ",@(15),str(timeout)
 0170 print "From: ",@(15),from_addr$
 0180 print "To: ",@(15),to_addr$
 0190 print 'LF',"Subject: ",'LF',subject$
 0200 print 'LF',"Body:",'LF',body$
 0210 print 'LF',"Calling *web/email"; wait 0
 0220 ok=0; call "*web/email",err=*next,from_addr$,"",to_addr$,"","","(*web/email) "+subject$,body$,"","",server$+";"+port$+tbl(nul(username$),";"+username$+";"+password$,""),timeout,-1,"",1,err_msg$,"",""; ok=1
Call:*web/email   [Pgm=TEST-EMAIL Stno=00220]
Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@133 System errno=2
Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@134 System errno=2
Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@135 System errno=2
Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@136 System errno=2
Error:17 Program=F:\infor\facts93\pvx\lib\_web\email@137 System errno=2
*web/email: Parsing email arguments
Open file(32767):F:\infor\facts93\pvx\lib\_web\webserv.mim   [Pgm=*web/email Stno=00147]
Call:*web/address;BreakDown   [Pgm=*web/email Stno=00246]
Call:*web/address;BreakDown   [Pgm=*web/email Stno=00283]
*web/email: Creating email
Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox\new   [Pgm=*web/email Stno=01047]
Close file(32766):*web/outbox/new   [Pgm=*web/email Stno=01047]
Error:26 Program=F:\infor\facts93\pvx\lib\_web\email@991 System errno=13
Tried to open F:\infor\facts93\pvx\lib\_web\outbox\new\24593497509628c40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\mods\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\mods\prog\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\prog\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\hotkeys\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\link\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\mods\prog\CS\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\prog\CS\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\prog\_w\_web\outbox\new\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Error:12 Program=F:\infor\facts93\pvx\lib\_web\email@996 System errno=2
Error:14 Program=F:\infor\facts93\pvx\lib\_web\email@1004 System errno=2
Error:26 Program=F:\infor\facts93\pvx\lib\_web\email@991 System errno=2
Tried to open F:\infor\facts93\pvx\lib\_web\outbox\24593497509628c40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\mods\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\mods\prog\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\prog\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\hotkeys\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\link\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\mods\prog\CS\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\prog\CS\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Tried to open F:\infor\facts93\prog\_w\_web\outbox\24593497509628C40211.eml and failed   [Pgm=*web/email Stno=00996]
Error:12 Program=F:\infor\facts93\pvx\lib\_web\email@996 System errno=2
Error:14 Program=F:\infor\facts93\pvx\lib\_web\email@1004 System errno=2
Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox\new\24593497509628c40211.eml   [Pgm=*web/email Stno=00534]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00565]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00566]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00578]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00579]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00586]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00602]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00605]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00606]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00612]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00613]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00614]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00629]
Write issued to *web/outbox/new/24593497509628C40211.eml (32766)    [Pgm=*web/email Stno=00653]
Close file(32766):*web/outbox/new/24593497509628C40211.eml   [Pgm=*web/email Stno=00840]
*web/email: Sending emails to SMTP Server
Call:*web/smtp   [Pgm=*web/email Stno=00844]
Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox   [Pgm=*web/smtp Stno=00523]
Close file(32766):*web/outbox   [Pgm=*web/smtp Stno=00527]
Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox\sent   [Pgm=*web/smtp Stno=00523]
Close file(32766):*web/outbox/sent   [Pgm=*web/smtp Stno=00527]
Open file(32766):F:\infor\facts93\pvx\lib\_web\outbox\sent   [Pgm=*web/smtp Stno=00502]
Close file(32766):*web/outbox/sent   [Pgm=*web/smtp Stno=00507]
Open file(32766):*memory*   [Pgm=*web/smtp Stno=00081]
Open file(32765):F:\infor\facts93\pvx\lib\_web\outbox\new\24593497509628c40211.eml   [Pgm=*web/smtp Stno=00087]
Close file(32765):F:\infor\facts93\pvx\lib\_web\outbox\new\24593497509628c40211.eml   [Pgm=*web/smtp Stno=00092]
Write issued to *memory* (32766)    [Pgm=*web/smtp Stno=00094]
Open file(32765):[tcp];0   [Pgm=*web/smtp Stno=00351]
Close file(32765):[tcp];0   [Pgm=*web/smtp Stno=00354]
*web/smtp: Try to connect to SMTP server
Error:0 Program=F:\infor\facts93\pvx\lib\_web\smtp@117 System errno=13
*web/smtp: [ERROR] Connect to SMTP Server: server-name;25 timed out. (0/117).


Close file(32766):*memory*   [Pgm=*web/smtp Stno=00316]
Error:0 Program=F:\infor\facts93\pvx\lib\_web\email@844 System errno=13
*web/email: [ERROR] Sending to SMTP Server Failed: (0): Connect to SMTP Server: server-name;25 timed out. (0/117).


Close file(32767):*web/webserv.mim   [Pgm=*web/email Stno=00901]
Error:0 Program=F:\infor\facts93\mods\TEST-EMAIL@220 System errno=2
 0230 print 'LF',"Result:",'LF',tbl(ok,err_msg$,"Email sent.")
 0240 if try_mail and not(ok) then {
 0280  }
 0290 end


Screen output:

Email Test
==========
Server:        server-name
Port:          25
User:
Timeout:       10
From:          facts@xxx.com
To:            ken@dpiserve.com


Subject:
Test Subject


Body:
Test message.


Server: server-name
Port: 25


Calling *web/email


Result:
Sending to SMTP Server Failed: (0): Connect to SMTP Server: server-name;25 ti
med out. (0/117).

Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 14, 2021, 06:12:47 PM
Regarding the error 17's with the addr's.  It seems that the error 17 only occurs if the program is already addr'd.  When I drop "*web/email" and then addr "*web/email", no error occurs.  When I do a second addr "*web/email", the error 17 occurs.
Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 14, 2021, 06:35:27 PM
Mike,


This makes no sense!  I can reproduce the error by opening the server/port with a tim= clause in the open.  If I exclude the tim= clause in the open, no error occurs!


This works:
open (1)"[tcp]server-name;25"


This generates an error 0 after 10 seconds:
open (1,tim=10)"[tcp]server-name;25"

Title: Re: *web/email error message (0/117)
Post by: Mike King on May 14, 2021, 06:43:26 PM
Something fishy about your error 17 -- I just tried this on version 15.10 and didn't get any errors:

PxPlus-2018 Web (Ver:15.10/MS-WINDOWS) Serno:1510-001-1234567
(c) Copyright 2005-2018 PVX Plus Technologies Ltd. (All rights reserved)
  Website: http://www.pvxplus.com
->10 addr "*web/email"
-:20 addr "*web/email"
-:30 addr "*web/email"
-:40 addr "*web/email"
-:run
-:


As for your problem with Email I have attached a replacement *web/smtp which doesn't have a TIM= on the open -- No idea why your system would have a problem with the TIM= but its worth a try to see if it works.  (This is a V15.10 *web/smtp with not TIM= on the OPEN)

Of course -- seeing you are getting some odd results with the ADDR directive perhaps your installation is bad.
Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 14, 2021, 06:51:17 PM
I agree, something's not right.  I'm going to recommend a reinstall of pxplus to see if that clears things up.
Title: Re: *web/email error message (0/117)
Post by: ChrisKCAi on May 17, 2021, 02:36:02 PM
Ken (Mike),

I'm not sure this is 100% the same case but, at the installation where we are encountering this, the server PxPlus is running on is also being used as the SMTP server.
Running V16.20 - Specifying server-name;25 or localhost;25 both failed with the 0/117 error. However local-ipaddr;25 seems to work. HTH.
Title: Re: *web/email error message (0/117)
Post by: Mike King on May 17, 2021, 02:54:17 PM
From what you have said, that sounds like the server is having an issue with IPv4 vs IPv6 resolution.

When you specify a server by name the system will attempt to look up the servers IP address which may come back as either IPv4 or IPv6.  What may be happening is we are getting the IPv6 address and not the IPv4 address and that might not be fully resolvable throughout your network (i.e your PC may handle it but all the routers for your internal network may not). 

For example on your system what type of address do you get when you 'ping localhost' IPv4 or IPv6?

Specifying the native IPv4 IP address avoids the issue as throughout the network as only the IPv4 addresses will then be used.

Generally Internet based name look ups come back with an IPv4 address, however its not uncommon for inhouse connections to come back with IPv6 addresses.

You might be able to resolve this issue by adding a IPV4ONLY=1 setting to your INI file in the [Config] section.  This will ignore any IPv6 addresses.
Title: Re: *web/email error message (0/117)
Post by: ChrisKCAi on May 17, 2021, 04:12:54 PM
Mike,

Yep, setting IPV4ONLY=1 does the trick and let's me supply the server name to *web/email as opposed to the IP address.

Thanks,

Chris
Title: Re: *web/email error message (0/117)
Post by: ChrisKCAi on May 17, 2021, 04:14:22 PM
For completeness, as Mike suggested, it is IPV4ONLY=1 (my previous post had originally left out the '4')
Title: Re: *web/email error message (0/117)
Post by: Ken Sproul on May 17, 2021, 07:00:30 PM
Mike,


I installed a fresh copy of PxPlus 15.10 using the .zip file.  The ADDR didn't error, but opening the tcp port using a tim= value still did.  I ran the original PxPlus installation by launching the pxplus.exe external to our application, meaning no custom startup.  When I did that, the ADDR didn't error either.  So I believe the original installation is good, but maybe our custom start up sets certain parameters that impact the behavior of ADDR.


After reading the recent posts from you and Chris, I tried the ini IPV4ONLY=1 setting, and that also worked for me.  Here's what's confusing though.  The issue only occurs when using a tim= value on the open.  Why does it only fail when using a tim= value on the open?  Is this a windows issue or a PxPlus issue?

Title: Re: *web/email error message (0/117)
Post by: Mike King on May 17, 2021, 08:18:13 PM
Not certain why the TIM= causes a problem with IPv6 enabled.  We will look into it however we don't actually do much different when connecting to IPv6.