Home
The Toolkit for Online Communities
17366 Community Members, 1 member online, 2270 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : getting email to work with openacs

Forum OpenACS Q&A: getting email to work with openacs

Icon of envelope Request notifications

Collapse
Posted by Matthew Geddert on
Hello all,

I am trying to do testing on some packages, but cannot continue. I
cannot get the email service to work at all i.e. its not just the
package i am testing, but also when you loggin and have the system
send you a password and stuff like that. I have qmail running on the
same server as openacs, and qmail works just fine... I followed the
instructions at http://openacs.org/doc/openacs-4/ exactly and mail
didn't just work, out of the box... what should i do?

Matthew

Collapse
Posted by Don Baccus on
What does your nsd.tcl file look like?  Use "pre" tags before you dump it here, please, unformatted source code's unreadable.

If qmail's listening on port 25 and you can send mail to it from outside AOLserver, then you've not set up AOLserver to point to qmail correctly.

Collapse
Posted by Matthew Geddert on
Well, i got it working, by switching off qmail and switching on sendmail (per Simon Millard's recommendation)... but i would like to know how to get it working with qmail. Qmail is listening to port 25 when it is turned on, it is not using a fully qualified domain name because it currently does not recieve external network mail (all the computers within the network are running a hosts file that does internal resolving). It is able to recieve and send mail to the internet at large from within other applications and from other computers within the office, since it works with other apps i am assuming that it should work with openacs... sendmail is set up the same way... i am guessing i would just need to tell openacs where qmail-inject is, but this is just a guess, i and i wouldn't know where to do this. It seems like with sendmail it knows to look at /usr/sbin/sendmail. Here is my nsd.tcl file:

ns_log notice "nsd.tcl: starting to read config file..."

# which database do you want? postgres or oracle
set database              postgres 

if {$database == "oracle"} {
    set db_password        "mysitepassword"
}

set httpport              80
set httpsport             443 

# The hostname and address should be set to actual values.
#set hostname               [ns_info hostname]
set hostname                officenet
#set address                [ns_info address]
set address                 192.168.1.6


set server              "testopenacs" 
set db_name             $server
set servername          "testopenacs.com Community"

set serverroot          "/web/${server}"

# if debug is false, all debugging will be turned off
set debug true

# you shouldn't need to adjust much below here
# for a standard install

# 
# AOLserver's home and binary directories. Autoconfigurable. 
#
set homedir                 [file dirname [ns_info config]] 
set bindir                  [file dirname [ns_info nsd]] 

#
# Where are your pages going to live ?
#
set pageroot                ${serverroot}/www 
set directoryfile           index.tcl,index.adp,index.html,index.htm

# 
# nsssl: Only loads if keyfile.pem and certfile.pem exist.
# If you are using SSL, make sure you have these dirs and files (refer
# to the AOLserver docs)

set sslkeyfile ${homedir}/servers/${server}/modules/nsssl/keyfile.pem
set sslcertfile ${homedir}/servers/${server}/modules/nsssl/certfile.pem 

# 
# Global server parameters 
#

ns_section ns/parameters 
ns_param   serverlog          ${homedir}/log/${server}-error.log 
ns_param   home               $homedir 
ns_param   maxkeepalive       0
ns_param   logroll            on
ns_param   maxbackup          5
ns_param   debug              $debug
ns_param   MailHost           officenet
# 
# Thread library (nsthread) parameters 
# 
ns_section ns/threads 
ns_param   mutexmeter         true      ;# measure lock contention 
ns_param   stacksize          [expr 128*1024]

# 
# MIME types. 
# 
#  Note: AOLserver already has an exhaustive list of MIME types, but in
#  case something is missing you can add it here. 
#

ns_section ns/mimetypes
ns_param   Default            text/plain
ns_param   NoExtension        text/plain
ns_param   .pcd               image/x-photo-cd
ns_param   .prc               application/x-pilot
ns_param   .xls               application/vnd.ms-excel

# 
# Tcl Configuration 
# 
ns_section ns/server/${server}/tcl
ns_param   library        ${serverroot}/tcl
ns_param   autoclose      on 
ns_param   debug          $debug
 

############################################################ 
# 
# Server-level configuration 
# 
#  There is only one server in AOLserver, but this is helpful when multiple
#  servers share the same configuration file.  This file assumes that only
#  one server is in use so it is set at the top in the "server" Tcl variable
#  Other host-specific values are set up above as Tcl variables, too.
# 
ns_section ns/servers 
ns_param   $server     $servername 

# 
# Server parameters 
# 
ns_section ns/server/${server} 
ns_param   directoryfile      $directoryfile
ns_param   pageroot           $pageroot
ns_param   maxconnections     5
ns_param   maxdropped         0
ns_param   maxthreads         5
ns_param   minthreads         5
ns_param   threadtimeout      120
ns_param   globalstats        false    ;# Enable built-in statistics 
ns_param   urlstats           false    ;# Enable URL statistics 
ns_param   maxurlstats        1000     ;# Max number of URL's to do stats on
#ns_param   directoryadp    $pageroot/dirlist.adp ;# Choose one or the other
#ns_param   directoryproc    _ns_dirlist          ;#  ...but not both!
#ns_param   directorylisting  fancy               ;# Can be simple or fancy

# 
# ADP (AOLserver Dynamic Page) configuration 
# 
ns_section ns/server/${server}/adp 
ns_param   map           /*.adp    ;# Extensions to parse as ADP's 
#ns_param   map          "/*.html" ;# Any extension can be mapped 
ns_param   enableexpire  false     ;# Set "Expires: now" on all ADP's 
ns_param   enabledebug   $debug    ;# Allow Tclpro debugging with "?debug"
ns_param   defaultparser fancy

ns_section ns/server/${server}/adp/parsers
ns_param   fancy	".adp"
 
# 
# Socket driver module (HTTP)  -- nssock 
# 
ns_section ns/server/${server}/module/nssock
ns_param   timeout            120
ns_param   address            $address
ns_param   hostname           $hostname
ns_param   port               $httpport

# 
# Socket driver module (HTTPS) -- nsssl 
# 
#  nsssl does not load unless sslkeyfile/sslcertfile exist (above).
# 
ns_section ns/server/${server}/module/nsssl 
ns_param   port        $httpsport 
ns_param   hostname    $hostname 
ns_param   address     $address 
ns_param   keyfile     $sslkeyfile 
ns_param   certfile    $sslcertfile

# 
# Database drivers 
# The database driver is specified here. PostgreSQL driver being loaded.
# Make sure you have the driver compiled and put it in {aolserverdir}/bin
#
ns_section "ns/db/drivers" 
if { $database == "oracle" } {
	ns_param   ora8            ${bindir}/ora8.so
} else {
	ns_param   postgres        ${bindir}/postgres.so  ;# Load PostgreSQL driver
}

# 
# Database Pools: This is how AOLserver  ``talks'' to the RDBMS. You need 
# three for OpenACS: main, log, subquery. Make sure to replace ``yourdb'' 
# and ``yourpassword'' with the actual values for your db name and the 
# password for it.

# AOLserver can have different pools connecting to different databases 
# and even different different database servers.
# 
ns_section ns/db/pools 
ns_param   pool1	   "Pool 1"
ns_param   pool2	   "Pool 2"
ns_param   pool3	   "Pool 3"

ns_section ns/db/pool/pool1
ns_param   maxidle            1000000000
ns_param   maxopen            1000000000
ns_param   connections        5
ns_param   verbose            $debug
ns_param   extendedtableinfo  true
ns_param   logsqlerrors       $debug
if { $database == "oracle" } {
    ns_param   driver             ora8
    ns_param   datasource         {}
    ns_param   user               $db_name
    ns_param   password           $db_password
} else {
    ns_param   driver             postgres 
    ns_param   datasource         localhost::${db_name}
    ns_param   user               nsadmin
    ns_param   password           ""
} 

ns_section ns/db/pool/pool2
ns_param   maxidle            1000000000
ns_param   maxopen            1000000000
ns_param   connections        5
ns_param   verbose            $debug
ns_param   extendedtableinfo  true
ns_param   logsqlerrors       $debug
if { $database == "oracle" } {
    ns_param   driver             ora8
    ns_param   datasource         {}
    ns_param   user               $db_name
    ns_param   password           $db_password
} else {
    ns_param   driver             postgres 
    ns_param   datasource         localhost::${db_name}
    ns_param   user               nsadmin
    ns_param   password           ""
} 

ns_section ns/db/pool/pool3
ns_param   maxidle            1000000000
ns_param   maxopen            1000000000
ns_param   connections        5
ns_param   verbose            $debug
ns_param   extendedtableinfo  true
ns_param   logsqlerrors       $debug
if { $database == "oracle" } {
    ns_param   driver             ora8
    ns_param   datasource         {}
    ns_param   user               $db_name
    ns_param   password           $db_password
} else {
    ns_param   driver             postgres 
    ns_param   datasource         localhost::${db_name}
    ns_param   user               nsadmin
    ns_param   password           ""
} 

ns_section ns/server/${server}/db
ns_param   pools              "*" 
ns_param   defaultpool        pool1

ns_section ns/server/${server}/redirects
ns_param   404                "global/file-not-found.html"
ns_param   403                "global/forbidden.html"

# 
# Access log -- nslog 
# 
ns_section ns/server/${server}/module/nslog 
ns_param   file                 ${homedir}/log/${server}.log
ns_param   enablehostnamelookup false
ns_param   logcombined          true
#ns_param   logrefer             false
#ns_param   loguseragent         false
ns_param   maxbackup            5
ns_param   rollday              *
ns_param   rollfmt              %Y-%m-%d-%H:%M
ns_param   rollhour             0
ns_param   rollonsignal         true
ns_param   rolllog              true

#
# nsjava - aolserver module that embeds a java virtual machine.  Needed to 
#          support webmail.  See http://nsjava.sourceforge.net for further 
#          details. This may need to be updated for OpenACS4 webmail
#

ns_section ns/server/${server}/module/nsjava
ns_param   enablejava         off  ;# Set to on to enable nsjava.
ns_param   verbosejvm         off  ;# Same as command line -debug.
ns_param   loglevel           Notice
ns_param   destroyjvm         off  ;# Destroy jvm on shutdown.
ns_param   disablejitcompiler off  
ns_param   classpath          /usr/local/jdk/jdk118_v1/lib/classes.zip:${bindir}/nsjava.jar:${pageroot}/webmail/java/activation.jar:${pageroot}/webmail/java/mail.jar:${pageroot}/webmail/java 

# 
# CGI interface -- nscgi, if you have legacy stuff. Tcl or ADP files inside 
# AOLserver are vastly superior to CGIs. I haven't tested these params but they
# should be right.
# 
#ns_section "ns/server/${server}/module/nscgi" 
#       ns_param   map "GET  /cgi-bin/ /web/$server/cgi-bin"
#       ns_param   map "POST /cgi-bin/ /web/$server/cgi-bin" 
#       ns_param   Interps CGIinterps

#ns_section "ns/interps/CGIinterps" 
#       ns_param .pl "/usr/bin/perl"

# 
# Modules to load 
# 
ns_section ns/server/${server}/modules 
ns_param   nssock          ${bindir}/nssock.so 
ns_param   nslog           ${bindir}/nslog.so 
ns_param   nssha1          ${bindir}/nssha1.so 
ns_param   nscache         ${bindir}/nscache.so 
ns_param   nsrewrite       ${bindir}/nsrewrite.so 
ns_param   nsxml           ${bindir}/nsxml.so 
ns_param   nsfts           ${bindir}/nsfts.so
#ns_param   nsperm          ${bindir}/nsperm.so 
#ns_param   nscgi           ${bindir}/nscgi.so 
#ns_param   nsjava          ${bindir}/libnsjava.so

#
## nsssl: loads only if requisite files already exist (see top of this
# file). 
#
if { [file exists $sslcertfile] && [file exists $sslkeyfile] } { 
    ns_param nsssl ${bindir}/nsssle.so 
} else { 
    ns_log warning "nsd.tcl: nsssl not loaded because key/cert files do not exist."
}

ns_log notice "nsd.tcl: finished reading config file."

Collapse
Posted by Dave Bauer on
Try Life with Qmail[1]. It has a section on replacing sendmail with qmail.

[1] http://www.lifewithqmail.org/

Collapse
Posted by Don Baccus on
i am guessing i would just need to tell openacs where qmail-inject is, but this is just a guess, i and i wouldn't know where to do this. It seems like with sendmail it knows to look at /usr/sbin/sendmail.
AOLserver doesn't call /usr/sbin/sendmail (or qmail-inject). It simply tries to establish an SMTP connection with whatever IP you've declared to be your "mailhost" in the nsd.tcl file.

In your case, this appears to be a machine called "officenet". Are you sure that qmail is accepting SMTP connections on "officenet" from whatever machine AOLserver is running on in your local network?

AOLserver doesn't care what your SMTP server is running. It just ships the mail off to port 25 on the configured server, that's all. Plenty of us us qmail here so that's not an issue.

Perhaps the /etc/hosts file on the webserver machine isn't set up with an entry for "officenet"? Maybe qmail's set up to not relay from other servers on your LAN?

The above are just wild guesses.

Collapse
Posted by Matthew Geddert on
The machine officenet is listening on port 25 via qmail running on the same machine (the officnet machine)... I am able to accept connections through port 25 (i.e. telnet into it) and send mail, but maybe there is a security setting with qmail that i haven't noticed with other applications. Now that I know that it only depends on port 25 relaying mail for me I am sure I can figure it out... thanks everybody.
Collapse
Posted by James Thornton on
Collapse
Posted by Matthew Geddert on
Well the problem is solved, and I am putting this hear just in case somebody searches for it (and it isn't deleted). All I had to do was edit /var/qmail/control/rcpthosts (the location may be different for your setup) to include the yahoo.com domain for relaying, this is because the reply address I have set on openacs is my email address at yahoo... Since I am behind a firewall and am only using this machine for testing/internal use I don't need to worry about other people relaying through it and the security implications that would apply. If you are on the open internet you may need to be more careful... allowing all of yahoo.com to relay could theoretically produces a lot of spam.

Thanks a lot for the help.

Collapse
Posted by Mat Kovach on
What you just did is wrong.

look at http://www.lifewithqmail.org

You need to add 'aaa.bbb.ccc.ddd:allow,RELAYCLIENT=""' in your
/etc/tcp.smtp (the tcprules files) and recreate the tcp.smtp.cdb
file.

LWQ explains it well.