Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
acs-mail-lite
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
acs-mail-lite
Commits
4adecd51
Commit
4adecd51
authored
Feb 10, 2013
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-- added support for "multipart/mixed" mails
currently ignores "text/html" tokens
parent
aed02f9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
12 deletions
+37
-12
incoming-mail-procs.tcl
tcl/incoming-mail-procs.tcl
+37
-12
No files found.
tcl/incoming-mail-procs.tcl
View file @
4adecd51
...
...
@@ -164,6 +164,7 @@ namespace eval acs_mail_lite {
@creation-date 2005-07-15
}
{
upvar
$array
email
#prepare the message
...
...
@@ -176,10 +177,11 @@ namespace eval acs_mail_lite {
ns_unlink
$file
return
}
#get the content type
set content
[
mime::getproperty
$mime
content
]
ns_log NOTICE
"incoming-mail-procs::parse_email: Content:
$content
"
#get all available headers
set keys
[
mime::getheader
$mime
-names
]
...
...
@@ -196,19 +198,25 @@ namespace eval acs_mail_lite {
#check for multipart, otherwise we only have one part
if
{
[
string
first
"multipart"
$content
]
!= -1
}
{
# ns_log NOTICE
"incoming-mail-procs::parse_email: Found multipart"
set parts
[
mime::getproperty
$mime
parts
]
}
else
{
# ns_log NOTICE
"incoming-mail-procs::parse_email: Multipart not found"
set parts
[
list
$mime
]
}
# travers the tree and extract parts into a flat list
set all_parts
[
list
]
foreach part
$parts
{
if
{[
mime::getproperty
$part
content
]
eq
"multipart/alternative"
}
{
ns_log NOTICE
"incoming-mail-procs::parse_email: Centent Property of Part:
[
mime::getproperty
$part
content
]
"
if
{[
mime::getproperty
$part
content
]
eq
"multipart/alternative"
||
[
mime::getproperty
$part
content
]
eq
"multipart/mixed"
}
{
foreach child_part
[
mime::getproperty
$part
parts
]
{
# ns_log NOTICE
"incoming-mail-procs::parse_email: Adding to all_parts (child):
$child
_part "
lappend all_parts
$child
_part
}
}
else
{
# ns_log NOTICE
"incoming-mail-procs::parse_email: Adding to all_parts (main):
$part
"
lappend all_parts
$part
}
}
...
...
@@ -216,24 +224,41 @@ namespace eval acs_mail_lite {
set bodies
[
list
]
set files
[
list
]
foreach part
$all
_parts
{
ns_log NOTICE
"incoming-mail-procs::parse_email: CONTENT for
$part:
[
mime::getproperty
$part
content
]
"
ns_log NOTICE
"incoming-mail-procs::parse_email: BUILDMMESSAGE for
$part:
[
mime::buildmessage
$part
]
"
ns_log NOTICE
"incoming-mail-procs::parse_email: CONTENT DISPOSITION:
[
catch
{[
mime::getheader
$part
Content-disposition
]}
errmsg
]
{
$errmsg
}"
}
#now extract all parts
(
bodies/files
)
and fill the email array
foreach part
$all
_parts
{
# ns_log NOTICE
"incoming-mail-procs::parse_email: Now working on part:
$part
"
# Attachments have a
"Content-disposition"
part
# Therefore we filter out if it is an attachment here
if
{[
catch
{
mime::getheader
$part
Content-disposition
}]
||
[
mime::getheader
$part
Content-disposition
]
eq
"inline"
}
{
switch
[
mime::getproperty
$part
content
]
{
"text/plain"
{
lappend bodies
[
list
"text/plain"
[
mime::getbody
$part
]]
}
"text/html"
{
lappend bodies
[
list
"text/html"
[
mime::getbody
$part
]]
# ns_log NOTICE
"incoming-mail-procs::parse_email: Entering Bodies .... "
if
[
catch
{
switch
[
mime::getproperty
$part
content
]
{
"text/plain"
{
lappend bodies
[
list
"text/plain"
[
mime::getbody
$part
]]
}
"text/html"
{
lappend bodies
[
list
"text/html"
[
mime::getbody
$part
]]
}
}
}
errmsg
]
{
ns_log NOTICE
"incoming-mail-procs::parse_email: Error evaluating mail body:
$errmsg
"
}
}
else
{
# ns_log NOTICE
"incoming-mail-procs::parse_email: Entering Attachments .... "
set encoding
[
mime::getproperty
$part
encoding
]
set body
[
mime::getbody
$part
-decode
]
set content
$body
set params
[
mime::getproperty
$part
params
]
# ns_log NOTICE
"incoming-mail-procs::parse_email: Params:
$params
"
array set param
$params
# Append the file if there exist a filename to use. Otherwise do not append
...
...
@@ -244,8 +269,7 @@ namespace eval acs_mail_lite {
set content_type
[
mime::getproperty
$part
content
]
if
{
$content
_type eq
"application/octet-stream"
}
{
set content_type
[
ns_guesstype
$filename
]
}
}
lappend files
[
list
$content
_type
$encoding
$filename
$content
]
}
}
...
...
@@ -256,6 +280,7 @@ namespace eval acs_mail_lite {
#release the message
mime::finalize
$mime
-subordinates all
}
ad_proc -public autoreply_p
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment