Forum OpenACS Q&A: Response to qmail confusion

Collapse
Posted by Glen Stewart on
I had a similar problem with Qmail today, and hacked around it by modifying AOLserver's aolserver/modules/tcl/sendmail.tcl file (and then restarting AOLserver). This change makes AOLserver (and ACS) execute the local sendmail instead of talking SMTP, getting past Qmail's relay situation. Only one proc needed to be changed, and here it is:

proc _ns_sendmail {smtp smtpport timeout tolist bcclist 
	from subject body extraheaders} {
    
    foreach f {/usr/lib/sendmail /usr/sbin/sendmail} {
      if {[file exists $f]} {
	set Mail(program) $f
	break
      }
    }
    
    ## Put the tolist in the headers
    set rfcto [join $tolist ", "]
    
    ## Build headers
    set msg "To: $rfcto
From: $from
Subject: $subject
Date: [ns_httptime [ns_time]]"
    
    ## Insert extra headers, if any (not for BCC)
    if ![string match "" $extraheaders] {
	set size [ns_set size $extraheaders]
	for {set i 0} {$i < $size} {incr i} {
	    append msg "
[ns_set key $extraheaders $i]: [ns_set value $extraheaders $i]"
	}
    }
    
    ## Blank line between headers and body
    append msg "

$body"
    
    ## pass message to sendmail
    if { [catch {
        exec $Mail(program) $rfcto << $msg
    } errMsg ] } {
	## Error, close and report
	return -code error "Unable to send mail"
    }
}