Forum OpenACS Q&A: Possible bug with acs-mail-lite?

Collapse
Posted by Nima Mazloumi on
Hi,

I tried to use

set extra_headers [ns_set new]
acs_mail_lite::send -to_addr $to \
-from_addr $from \
-subject $subject \
-body $body \
-mime_type "text/html" \
-extraheaders $extra_headers

to send out an email. But randomly I get the error:

can't read "state(header)": no such variable

This comes from the mime package from tcllib.

The email is sent out but without subject, body and with undisclosed-recipients.

I am using latest code in HEAD.

Collapse
Posted by Emmanuelle Raffenne on
Hi Nima,

Which version of Tcllib are you using?

Collapse
Posted by Nima Mazloumi on
I use 1.10
Collapse
Posted by Emmanuelle Raffenne on
Nima,

It looks like you pass an empty set to extraheaders. This arg is optional, if there's no extra headers, don't set it. On the other hand, extraheaders should be a list of pairs.

Collapse
Posted by Nima Mazloumi on
This error occurs even without the extra headers.
Collapse
Posted by Emmanuelle Raffenne on
Nima,

OK. I'm going to install tcllib 1.10 then. I don't have that problem with tcllib 1.8 and IIRC I didn't either when I tested with 1.10 but I may have missed something.

Collapse
Posted by Emmanuelle Raffenne on
Hi Nima and all,

I've committed a fix at oacs-5-4. Stefan and I tested with both tcllib 1.8 and 1.10 and it appears to work correctly now (no more random errors) but I'd appreciate if you test too and confirm the fix.

Since it was a random error, it's hard to say what caused it. Anyway, the fix consists of reordering in a more logical way the steps to build the message and add the headers. It looks like tcllib is very picky with that.