Forum OpenACS Q&A: Re: Experience with email to forums?
Although here is lot of functionality that is in the reply via email built in only if you use notificaions from the branch oacs-4-6.
<pre>
Hello,
Adding attachments to things that don't already support them is a
non-trivial task. I looked into adding attachments to bulk mail and
even for the web interface it is tricky. It's not impossible to do
this, but it's definitely a more complicated task than I can help you
with over e-mail. You might want to post and find out if anyone has
already done it, and ask for general assistance. I'm very busy and you
will not make very fast progress if you depend on me for help.
Good luck,
janine
On Tuesday, August 26, 2003, at 10:57 AM, Amit Kumar Singh wrote:
<blockquote> Dear Janine,
It was so nice of you for such a quick reply. I will get the files and
check
them out. Although I tried to find some mention about your
enhancements I
couldn't. I will try to install the files and document the paths I
followed
to get such a nice functionality and post them on the forums. It is a
nice
feature but less documented. I need some more help.
Is it possible to get the attachments and stuff into forums via attach
thrpugh emails(web interface works fine) if yes ? can you give a lead
or
some steps where I can modify the code and get it all working.
Can the attachments be sent as part of forum notifications ? (first
step
would be to implement for instant notifications) Can you help with some
leads onto this also.
Thanks fro the great work
Regards
Amit
-----Original Message-----
From: Janine Sisk [mailto:jsisk@mit.edu]
Sent: Tuesday, August 26, 2003 6:19 PM
To: mailto:aksingh@taru.org
Subject: Re: [Fwd: Re: Parsing an incoming multi-part e-mail message]
Hi,
The three files you were asking about below should have been in
packages/acs-tcl/tcl, and I could swear I already committed them, but
they aren't there. So I just committed them again, and you should be
able to get them off of the oacs-46 branch.
janine
On Tuesday, August 26, 2003, at 07:16 AM, mailto:aksingh@taru.org wrote:
> Can you help me out with this ???
>
> While parsing incoming emails I get an error
>
> Error: invalid command name "parse_incoming_email"
> invalid command name "parse_incoming_email"
> while executing
> "parse_incoming_email $orig_file"
> (procedure "load_qmail_mail_queue" line 84)
> invoked from within
> "load_qmail_mail_queue -queue_dir [qmail_mail_queue_dir"
> (procedure "notification::email::scan_replies" line 3)
> invoked from within
> "notification::email::scan_replies"
> (procedure
> "AcsSc.NotificationDeliveryMethod.ScanReplies.notification_em..." line
> 1)
> invoked from within
> "AcsSc.NotificationDeliveryMethod.ScanReplies.notification_email"
> ("uplevel" body line 1)
> invoked from within
> "uplevel $func_and_args"
> (procedure "apply" line 3)
> invoked from within
> "apply $proc_name $arguments"
> (procedure "acs_sc_call" line 5)
> invoked from within
> "acs_sc_call NotificationDeliveryMethod ScanReplies $args
> $impl_key"
> (procedure "notification::delivery::scan_replies" line 12)
> invoked from within
> "notification::delivery::scan_replies -delivery_method_id
> $delivery_method_id"
> (procedure "notification::reply::sweep::scan_all_replies" line
> 10)
> invoked from within
> "notification::reply::sweep::scan_all_replies"
> ("eval" body line 1)
> invoked from within
> "eval [concat [list $proc] $args]"
> (procedure "ad_run_scheduled_proc" line 43)
> invoked from within
> "ad_run_scheduled_proc {t f 60
> notification::reply::sweep::scan_all_replies
> {} 1061803807 0 t}"
> Notice: Running scheduled proc
> notification::reply::sweep::process_all_replies...
>
>
> I can trace the proc to a file in acs-tcl/tcl directory the file is
> called
> "html-email-procs.tcl" But this proc requires
>
> ad_proc parse_incoming_email {
> message
> } {
> Takes an incoming message and splits it into parts. The main goal
> of this proc is to return something that can be stuffed into the
> database somewhere, such as a forum message. Since we aggressively
> filter HTML, the HTML tags are stripped out of the returned content.
>
> The message may have only plain text, plain text and HTML, or plain
> text and something else (Apple Mail uses text/enhanced, for
> example).
> To make our lives simpler we support only text/html as a special
> case;
> in all other cases the plain text is returned.
> } {
> # look for the files we need. If they aren't there, we can't do
> anything
> # and will just return the message as-is (cringe)
> set source_dir [acs_root_dir]/packages/acs-tcl/tcl
> if { ![file exists $source_dir/base64.tcl] ||
> ![file exists $source_dir/md5.tcl] ||
> ![file exists $source_dir/mime.tcl] } {
> return $message
> }
>
> source $source_dir/base64.tcl
> source $source_dir/md5.tcl
> source $source_dir/mime.tcl
> package require mime
>
> set mime [mime::initialize -string $message]
> set content [mime::getproperty $mime content]
>
> if { [string first "multipart" $content] != -1 } {
> set parts [mime::getproperty $mime parts]
> } else {
> set parts [list $mime]
> }
>
> foreach part $parts {
> switch [mime::getproperty $part content] {
> "text/plain" {
> set plain [mime::getbody $part]
> }
> "text/html" {
> set html [mime::getbody $part]
> }
> }
> }
>
> if { [info exists html] } {
> set body [ad_html_to_text $html]
> } elseif { [info exists plain] } {
> set body $plain
> } else {
> set body $message
> }
>
> mime::finalize $mime -subordinates all
> return $body
> }
>
> Where can I find these files.
>
> source $source_dir/base64.tcl
> source $source_dir/md5.tcl
> source $source_dir/mime.tcl
> package require mime
>
> Thanks
>
> ===================================
>
> On Jun 10 2003 19:12:45, Matthew Walker wrote:
>
> You should be passing in the complete message including headers to
> mime::initialize. In particular the Content-Type header. By doing this
> it is also able to work out that a plain text message is just that
> even when there are no MIME related headers and my code will still
> work and pass back the plain text.
>
> In terms of the versions of mime.tcl I believe TclMime was merged into
> tcllib. You can get tcllib from
> <http://sourceforge.net/projects/tcllib/>. I'd suggest actually using
> the latest version of mime.tcl from the sourceforge CVS, there's been
> a few bug fixes recently. It will probably require a couple of lines
> of editing to work in aolserver/openacs to remove some dependencies
> (on Trf and something I can't remember), I'll dig these out if you
> like.
>
>
</blockquote>
</pre>
Although not documented I am using it for now atleast two weeks and uptill now none of the users have complaint of the mails being lost or any loops etc. But surely this will depend on what you wnat to use. I am trying to embed the sourcing of attachments into the forums and will be able to do so in two weeks.
As for the mime I am getting responses from MAC's L'unix and MS but uptil now no complaints. (Only thing to take care is that you don't quote back the message you are replying to -- this confuses the mime script and in that case either the whole message would be stuffed or DELETED.
I am also working on starting new threads with specific email subject (starting code that get changed every week-Randomly) (to stop unwanted emails in the system) so that members are able to post in the respective forums they want to. Although this can support a small amount of forums say five. The incoming email id for each forms are generated randomly every week and attached as a footer to all the notifications going out from the forums.