Forum OpenACS Development: Re: Can't send mail from acs-mail-lite

Collapse
Posted by Brad Duell on
That's funny that you bring this up, because I recently ran across this, and I thought perhaps it was just a misconfiguration on my end.

I finally decided to add the following to my aolserver/modules/tcl/sendmail.tcl file, just after the "## Insert extra headers, if any (not for BCC)" line in the _ns_sendmail proc:

## Insert extra headers, if any (not for BCC)"
if { ![empty_string_p $extraheaders] && [catch { [ns_set size $extraheaders] } ] } {
  set extra_headers [ns_set create]
  for {set i 0} {$i < [llength $extraheaders]} {incr i} {
      ns_set put $extra_headers [lindex $extraheaders $i] [lindex $extraheaders [expr $i + 1]]
      incr i
  }
  set extraheaders $extra_headers
}

This now works for me.

Anyone know why it seems we now have to kludge the sendmail proc?  Extraheaders is just kept as a list in acs-mail-lite.

Collapse
Posted by Steve Manning on
Thanks Brad thats the way I was heading but I thought I'd check to make sure I've not missed something before posting a bug. I can't see how extra_headers could be a set when its stored as a list on the table so something has gone pear shaped somewhere.

Does anyone have this working without modifying sendmail.tcl?

    Steve

Collapse
Posted by Jeff Davis on
It turns out the rewrite of acs-mail-lite ignored the acs-rollout-support stuff since it dispensed with the ns_sendmail call (acs-rollout-support redefined ns_sendmail to do it's magic). Jade put something back in to do rollout support but when he did he got the extraheaders bit wrong (since it's a list at that point). For ns_sendmail it's always been an ns_set and it's wrong to change it to try to treat it as a list if it's not an ns_set -- look for the comment about Rollout support in acs-mail-lite-procs.tcl in function deliver_mail and you will see where it's broken.
Collapse
Posted by Steve Manning on
Ah I see. In deliver_mail before the ns_sendmail line I add

set eh [util_list_to_ns_set $extraheaders]

and then replace $extraheaders with $eh in the ns_sendmail parameters.

Thanks Jeff. Later today I'll add that as a bug and patch if its not already there.

Steve

Collapse
Posted by Jeff Davis on
I committed a fix for this to HEAD. It should not happen on 5.1 since on 5.1 the acs-rollout-support stuff is still just ignored in acs-mail-lite. bcc also needs to be fixed but I think in rollout support the bcc is just ignored so maybe it does not matter.
Collapse
Posted by Steve Manning on
My version is straight out of the repository two days ago. A quick browse of the cvs shows that version 1.16 of acs-mail-lite-procs.tcl contains the fix but the repository is bringing back v1.15. Does 1.16 need to be tagged as openacs-5.1-compat for the repository to return it?

    Steve
Collapse
Posted by Jeff Davis on
I don't know why the openacs-5-1-compat tag is on HEAD rather than the 5.1 branch; that seems wrong to me. I moved the openacs-5.1-compat to 1.16 though so you should be able to update to pick up the fix.