ns_sendmail can't work for non-ascii subject and body.
I wrote the simple wrapper. is it possible to fix upstream version
or add like wrapper?
============================
# note: _ns_sendmail is exists!
if {[info commands orig_ns_sendmail] eq {}} {
rename ns_sendmail orig_ns_sendmail
package require base64
# headers are ignored!
proc ns_sendmail {to from subject body args} {
set headerSet [ns_set create]
ns_set put $headerSet Content-Type {text/plain; charset=UTF-8}
ns_set put $headerSet Content-Transfer-Encoding base64
ns_set put $headerSet MIME-Version 1.0
set subject [base64::encode [encoding convertto utf-8 $subject]]
set subject "=?UTF-8?B?${subject}?="
set body [base64::encode [encoding convertto utf-8 $body]]
orig_ns_sendmail $to $from $subject $body $headerSet [lindex $args 1]
}
}
============================
Best regards, Alexey Pechnikov.
http://pechnikov.tel/
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <list...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
Nice wrapper - this assumes the receipient can understand MIME-encoded
mail, which is probably the case but would break existing code that
expects outgoing mail having the old behavior.
Perhaps only define the wrapper if a ns_param is set in the
configuration, and by default not apply the wrapper? Or, better yet:
integrate your change into ns_sendmail directly and again, activate it
using an optional proc argument or ns_param config setting.
Ideally, it's probably best to work to define a reasonable "ns_mail"
interface and implement it. ns_sendmail is an ugly wart that needs to
go ...
--
Dossy Shiobara | do...@panoptic.com | http://dossy.org/
Panoptic Computer Network | http://panoptic.com/
"He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on." (p. 70)
On Wednesday 27 May 2009 00:33:59 Bernhard van Woerden wrote:
> If the subject is long then it should really go on multiple lines using
> header folding.
Well, it's right comment.
===============
# note: _ns_sendmail is exists!
if {[info commands orig_ns_sendmail] eq {}} {
rename ns_sendmail orig_ns_sendmail
package require base64
package require mime
# headers are ignored!
proc ns_sendmail {to from subject body args} {
set headerSet [ns_set create]
ns_set put $headerSet Content-Type {text/plain; charset=UTF-8}
ns_set put $headerSet Content-Transfer-Encoding base64
ns_set put $headerSet MIME-Version 1.0
orig_ns_sendmail $to \
$from \
[mime::word_encode utf-8 quoted-printable [encoding convertto utf-8 $subject]] \
[base64::encode [encoding convertto utf-8 $body]] \
$headerSet [lindex $args 1]
}
}
===============
> The From and To headers may also contain non ASCII characters.
This code may be simple too, I must to think about...