Forum OpenACS Q&A: ns_sendmail

Collapse
Posted by James Bennin on
Where is the procedure ns_sendmail declared?  I think I need to make some modification to that procedure.
Collapse
2: Re: ns_sendmail (response to 1)
Posted by Mat Kovach on
ns_sendmail is defined in /usr/local/aolserver/modules/tcl/sendmail.tcl

It is not part of OpenACS.

Collapse
3: Re: ns_sendmail (response to 2)
Posted by James Bennin on
Thank you for letting me know.  But isnt it used in OpenACS?  I believe so because in my error log I keep getting this error:

<pre>
[21/Aug/2003:16:41:29][4410.237579][-sched:9-] Error: ns_sendmail failed: could not connect to "localhost:25"
</pre>

Collapse
5: Re: ns_sendmail (response to 1)
Posted by C. R. Oldham on
You don't have an smtp server running and listening on your local machine then.
Collapse
4: Re: ns_sendmail (response to 2)
Posted by Mat Kovach on
Yes, it is used in OpenACS.  The problem you are having is that (as the error messages states), your machine can not connect to localhost (127.0.0.1) port 25.

Do you have a mail server running on the server?
netstat -na | grep 25

Can you telnet to localhost, port 25
telnet localhost 25

You might have to change the settings in the your conifg file to point to a working mail server on your network:
ns_param  mailhost        smtp.yourcompany.com ;# SMTP host for ns_sendmail

Collapse
6: Re: ns_sendmail (response to 1)
Posted by Jarkko Laine on
James,

Like you were told in a previous <a href="/forums/message-view?message_id=115843">thread</a> (and a couple of times in this thread), your problem most probably is, that your mail transfer agent is not running (or at least accepting connections). I don't think modifying ns_sendmail will help you here.

Collapse
7: Re: ns_sendmail (response to 6)
Posted by James Bennin on
I fixed the ns_sendmail proc, by replacing the smtp parameter with my mail server.  It is now working fine.  Thank you for your help.
Collapse
8: Re: ns_sendmail (response to 7)
Posted by Andrew Piskorski on
Ah, you "fixed" it? More like, you broke it. Note that the ns_sendmail code specifically does this:
set smtp [ns_config ns/parameters mailhost]
That gets the SMTP server from your AOLserver config file. If you have no such entry in your config file, ns_sendmail defaults to using localhost. So all you had to do was add the proper mailhost line into your config file.
Collapse
9: Re: ns_sendmail (response to 8)
Posted by James Bennin on
Hey buddy, I fixed and it works fine, ok.  I did not break anything.  The mail is able to go out to its proper recipients and I am not getting any sendmail error any more.  And by the way, setting smtp with my mailhost/server name is what I did to fix.  So thank you for your comments.