1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
<!--
$FML: queue.sgml,v 1.2 2005/07/20 10:39:17 fukachan Exp $
$jaFML: queue.sgml,v 1.3 2003/04/15 14:51:37 fukachan Exp $
-->
<sect1 id="message.queue.incoming">
<TITLE>
Incoming Queuing
</TITLE>
<para>
MTA kicks off a fml process. It reads a message from STDIN.
</para>
<para>
The fml process reads a message once and write it onto the hard disk
(write it into the incoming queue). After the queuing succeeded, the
process starts to analyze a message. For this logic, the original mail
is saved before main processing starts.
</para>
<para>
If the queuing fails, fml calls exit(EX_TEMPFAIL). In almost cases,
exit(75). If MTA receives this exit code, MTA tries to deliver again
later.
</para>
<para>
Mail::Delivery::Queue class processes the incoming queue.
The queus is removed when the process ends.
</para>
</sect1>
<sect1 id="message.queue.outgoing">
<TITLE>
fml Sends Back A Mail Message
</TITLE>
<para>
Mail::Delivery::Queue class inserts a message to send back into the
mail queue. Later FML::Process::QueueManager handles the real delivery
process.
</para>
<para>
Article delivery processing is a little diffferent but based on
queueing by Mail::Delivery::Queue. If someting error occurs in
delivery, another fml process tries to deliver it later.
</para>
<sect2>
<title>
Coding In &fml8; Sources.
</title>
<para>
Code is like this to send back a message:
<screen>
$curproc->reply_message( "you are not a ML member." );
</screen>
If no recipient specified, the recipient is the sender of the message
(From: address).
</para>
<para>
To send a file, like this:
<screen>
$curproc->reply_message( {
type => "text/plain; charset=iso-2022-jp",
path => "/etc/fml/main.cf",
filename => "main.cf",
disposition => "main.cf example",
});
$curproc->reply_message( {
type => "image/gif",
path => "/some/where/logo001.gif",
filename => "logo.gif",
disposition => "attachment",
});
</screen>
</para>
</sect2>
</sect1>
<sect1 id="message.queue">
<TITLE>
Mail Queue And Delivery System
</TITLE>
<para>
FML::Process::QueueManager picks up one queue from the queue directory.
Mail::Message parses it.
Mail::Delivery processes the real delivery via FML::Mailer.
<screen>
Mail::Delivery::Queue
|
| ---> queue directory
V
FML::Process::QueueManager
|
| <--- queue directory
V
FML::Mailer
|
V
Mail::Delivery
</screen>
</para>
<para>
In manipulating queue, we should lock the target queue by flock(2).
</para>
</sect1>
<sect1>
<TITLE>
Mail Queue Directory
</TITLE>
<para>
The queue directory consists of the following plural directories:
<screen>
new/
active/
incoming/
deferred/
info/sender/
info/recipients/
info/transport/
</screen>
info/ stores envelope information.
incoming/ holds incoming queue, others hold outgoing information.
</para>
<para>
In creating a new outgoing queue file,
make a temporary file in new/ once.
When the delivery preparation is ended,
move the queue from new/ to active/.
Hence files under active/ is delivery ready.
</para>
<sect2>
<title>
Lock The Queue
</title>
<para>
When we need to handle the specific queue file,
use lock()/unlock() method for each $queue_id object.
The lock algorithm is based on flock(2) for the file.
</para>
</sect2>
</sect1>
|