Roberto, ns_sendmail works by opening an IP connection to port 25 of the host you specify as the mailhost setting in the config file (.ini/.tcl). It then engages in SMTP dialouge with the specified MTA. The source really isn't all that long, and if you haven't looked before, it's worth a quick read. You can find it under [ns_info home]/modules/tcl/sendmail.tcl