Forum OpenACS Q&A: problem in executing ns_sendmail

I am trying to execute ns_sendmail command but it displays following errors ;


    could not connect to "localhost:25"
        while executing
    "ns_sockopen $smtp $smtpport"
        (procedure "_ns_sendmail" line 31)
        invoked from within
    "_ns_sendmail $smtp $smtpport $timeout $tolist $bcclist  $from $subject $body $extraheaders"
        (procedure "ns_sendmail" line 58)
        invoked from within
    "ns_sendmail $admin_email  "mailto:pkh_nik@indiatimes.com"; "Request for approval regarding room Reservation" $msg $extraheaders "
        invoked from within
    "if { [string compare $requires_permission_p "Y"] } {

      db_dml assign_room  "insert into reservations values ($room_id,$start_time,$end_time,$user_id,..."
        (file "/webroot/pharshwal/www/reserve/new-2.tcl" line 15)
        invoked from within
    "source [ad_conn file]"
        (procedure "rp_handle_tcl_request" line 2)
        invoked from within
    "rp_handle_tcl_request"
        invoked from within
    "catch $handler error"
        invoked from within
    "rp_abstract_url_server"
Collapse
Posted by Patrick Giagnocavo on
Your email server is not listening on the IP address that localhost resolves to.  Usually this is 127.0.0.1 .

The quick fix is to modify the MailHost parameter in your nsd.tcl config file, and point it to the public IP address (that is, the IP address bound to your machine's ethernet card).

Many mail servers will not listen on 127.0.0.1 unless specifically told to, even if you tell the mail server program to listen on "all" ports.