KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using IT_SetPort to change the SMTP port
PRODUCT: 4D Internet Commands | VERSION: 2004 | PLATFORM: Mac & Win
Published On: September 12, 2007

Many Internet Service Providers (ISP's) are now blocking the usage of port 25 (SMTP or Simple Mail Transport Protocol) in order to reduce the amount of SPAM sent over their networks. Since every e-mail server and e-mail client expects to use port 25, by default, e-mail might not be delivered without changes to your e-mail client software.

By default, 4D Internet Commands SMTP commands such as SMTP_Host expect to use port 25 to send their data. This can be easily changed by using the IT_SetPort Command. Simply add code like the following to change port 25 to the port you desire:

C_INTEGER($remoteport)
$remoteport:=587
$error:=IT_SetPort(2;$remoteport) `2 is for SMTP, see the docs referenced above.


In this example all future SMTP traffic will be directed over port 587.

* A word of caution, please be well informed about what services and software your e-mail server is running. You need to run SMTP on a port that is not being used already by another system service. You cannot run multiple services on the same port.