Move the 'mail' documentation out of the Haiku Book.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21218 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Niels Sascha Reedijk
2007-05-23 10:03:30 +00:00
parent bef614ef09
commit 1e36cfc272
47 changed files with 0 additions and 0 deletions
@@ -1,207 +0,0 @@
How to Send Customized E-Mail
So you wish to send out customized e-mail to many people? Please reconsider
doing that, if it is unwanted spam. Still want to do it? Here's one way of
doing it:
Save your message text in a file named "TemplateLetter.txt". It should look
something like this (I didn't word wrap the paragraphs, leaving each as one
long line, because the length would change depending on the inserted text
length):
Hi there NAME, how are you today?
I'm sending this message to EMAIL to inform you about a good deal for your company, COMPANY.
Hope you like it.
- Alex
Then save this following text as a script file, call it "MailToTemplate":
#!/bin/sh
# Make a mail merge letter by combining data from a given people file and a
# template letter text file.
# $Revision: 1.2 $
# Some code from Scot Hacker's PeoplePorter http://www.bebits.com/app/1747
PeopleFile=$1
echo "Mail merging using people file: $PeopleFile"
Name=$(catattr META:name "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)
EMail=$(catattr META:email "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)
Company=$(catattr META:company "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)
sed "s/NAME/$Name/g" <TemplateLetter.txt >/tmp/stage1
sed "s/EMAIL/$EMail/g" </tmp/stage1 >/tmp/stage2
sed "s/COMPANY/$Company/g" </tmp/stage2 >/tmp/stage3
mail -v -s "Test Message to $Name" "$EMail" </tmp/stage3
After you have saved it, make it executable with the "chmod a+x MailToTemplate"
command. Then run it with a people file as an argument:
Fri Jun 13 12:13:11 67 /Programming/bemaildaemon/documentation/Mass Mailing>MailToTemplate /boot/home/people/Test\ Person
Mail merging using people file: /boot/home/people/Test Person
EOT
sent successfully!
And the result will be an e-mail like this:
Subject: Test Message to Mr. Test A. Person
To: [email protected]
Date: Fri, 13 Jun 2003 12:13:29 -0400 EDT
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi there Mr. Test A. Person, how are you today=3F
I'm sending this message to [email protected] to inform you about a good deal for your company, Masters of Scripting, Inc..
Hope you like it.
- Alex
If you want to use the BeOS attribute indices system to select people, you can
run the results of a query though the mail customizing script like this example
(watch out - very long line) which sends the e-mail to all people (presumably
the people files are on the /boot disk volume, which is why the -v is needed)
with "test" in their groups listing:
Fri Jun 13 12:24:14 78 /Programming/bemaildaemon/documentation/Mass Mailing>query -v /boot META:group=*test* | sed "s/^/MailToTemplate /g" >/tmp/BatchMailCommands ; source /tmp/BatchMailCommands
Mail merging using people file: /boot/home/people/Test Person
EOT
sent successfully!
Mail merging using people file: /boot/home/people/Another Test
EOT
sent successfully!
Just so you know how it works, here is the batch commands file which was
automatically generated and used in the previous step:
Fri Jun 13 12:24:20 79 /Programming/bemaildaemon/documentation/Mass Mailing>cat /tmp/BatchMailCommands
MailToTemplate /boot/home/people/Test\ Person
MailToTemplate /boot/home/people/Another\ Test
Finally, if you want to do fancier messages, like HTML mixed ones, you have to
also specify the headers. Since the usual "mail" program doesn't let you do
that, you have to prepare the entire message and use the attribute system to
tag it for mailing. Look at an existing message in your out box to see the
attributes needed.
Prepare the message elsewhere (use some other e-mail package which lets you
insert HTML and pictures) then mail it to yourself, open the resulting file in
BeIDE (it takes care of the CRLF end of line conversion problems automatically,
you want this template file to have CRLF line ends, the earlier example doesn't
use them) and edit it to make it into a new message like this one:
To: "NAME" <EMAIL>
From: "Imaginary Test Account" <[email protected]>
Subject: Hi there NAME
Mime-Version: 1.0
Content-Type: multipart/related;
type="multipart/alternative";
boundary="----=_NextPart_000_0009_01C331AA.016FA080"
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C331AA.016FA080
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_000A_01C331AA.016FA080"
------=_NextPart_001_000A_01C331AA.016FA080
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi NAME, this is a reminder that you shouldn't annoy people with [No Spam Icon] spam!
--------------------------------------------------------------------------------
Fine print: Even if it is customised and otherwise pretty.
------=_NextPart_001_000A_01C331AA.016FA080
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<HTML><HEAD><TITLE>This is your Spam!</TITLE></HEAD>
<BODY BGCOLOR=3DWHITE>
<P>Hi NAME, this is a <STRONG>reminder</STRONG> that <FONT COLOR=3DBLUE SIZE=3D5>you</FONT>
<STRONG>shouldn't</STRONG> annoy <FONT COLOR=3DRED>people</FONT> with
<IMG alt=3D"[No Spam Icon]" WIDTH=3D32 HEIGHT=3D32
SRC=3D"cid:[email protected]"
BORDER=3D0> spam!
<HR>
<P><FONT size=3D1>Fine print: Even if it is customised and otherwise
pretty.</FONT>
</BODY></HTML>
------=_NextPart_001_000A_01C331AA.016FA080--
------=_NextPart_000_0009_01C331AA.016FA080
Content-Type: image/png;
name="NoSpamIcon.png"
Content-Transfer-Encoding: base64
Content-ID: <[email protected]>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABTElEQVR42r2XDQ6DMAhGuVPvtHP0
GN5ph2KpqY5QoF/xx4Rs2UzfAysKMXAQUSqgtREwJwMRoQhuLVon4YksCVAAnh2eiCdBMzgKRkQs
CZrBrxwEVILehFsS9BbcuxyDwGPwvi8GgTuzj+BaQPQJ/J6ddUcLrjtjvSpwLrZ9mL/bHmHm7bwe
pPbCIGDepzqLDm1RgswlmEv5f4oqhAIW8IyefQjv553VavAeoYALFiUP4fJ8HYiABhfx2/F9mrkU
VnC5D3wBla1cFMo8KP9yBaDdLs4pcgMem2+pAn2xomQ8eAGvu9UL4AqEZQ+gGqw74v6f2aOR3Q5A
rb4yNKJIAG4yQbbLArzQ21ffgk2OZ8Y3vyO4j2PP7km4KeBJPAk334prYrjIwt25oCanHPkUTb2W
zyQYmQcXpyPKTDmZGTE1nGqR+uZweseojhw/XAq+WQDwT5wAAAAASUVORK5CYII=
------=_NextPart_000_0009_01C331AA.016FA080--
Then in the mailing script, rather than calling "mail" to do the job, you have
to add attributes to the final file. Some you can clone from another outgoing
mail (like the chain), others you need to set to specify the recipient. Here's
the current full set:
Type Size Name
---------- --------- -------------------------------
MIME str 13 BEOS:TYPE
Text 46 MAIL:recipients
Text 43 MAIL:to
Text 1 MAIL:cc
Text 42 MAIL:subject
Text 1 MAIL:reply
Text 46 MAIL:from
Text 4 MAIL:mime
Text 18 MAIL:account
0x54494d45 4 MAIL:when
Int-32 4 MAIL:flags
Int-32 4 MAIL:chain
Text 5 MAIL:status
You need at the minimum:
BEOS:TYPE set to: text/x-email
MAIL:recipients lists the address you are sending to, for example: <[email protected]>
MAIL:from lists your return address: "Imaginary Test Account" <[email protected]>
MAIL:chain set to your outgoing mail chain number, happens to be 1 here.
MAIL:flags set to 5.
The commands to do that look like:
addattr -t string BEOS:TYPE text/x-email /tmp/stage3
addattr -t string MAIL:recipients "<$EMail>" /tmp/stage3
addattr -t string MAIL:from "\"Imaginary Test Account\" <[email protected]>" /tmp/stage3
addattr -t int MAIL:chain 1 /tmp/stage3
addattr -t int MAIL:flags 5 /tmp/stage3
Then move the message to the /boot/home/mail/out folder, using a unique name,
since there has to be one file for each person. A suitable command might be:
mv /tmp/stage3 "/boot/home/mail/out/MessageTo$EMail"
Finally, tell the daemon to check for mail. Right click on the mailbox icon in
the deskbar and pick "check for mail". It will then send all the pending mail.
@@ -1,18 +0,0 @@
#!/bin/sh
# Make a mail merge letter by combining data from a given people file and a
# template letter text file.
# $Revision: 1.1 $
# Some code from Scot Hacker's PeoplePorter http://www.bebits.com/app/1747
PeopleFile=$1
echo "Mail merging using people file: $PeopleFile"
Name=$(catattr META:name "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)
EMail=$(catattr META:email "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)
Company=$(catattr META:company "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)
sed "s/NAME/$Name/g" <TemplateLetter.txt >/tmp/stage1
sed "s/EMAIL/$EMail/g" </tmp/stage1 >/tmp/stage2
sed "s/COMPANY/$Company/g" </tmp/stage2 >/tmp/stage3
mail -v -s "Test Message to $Name" "$EMail" </tmp/stage3
@@ -1,7 +0,0 @@
Hi there NAME, how are you today?
I'm sending this message to EMAIL to inform you about a good deal for your company, COMPANY.
Hope you like it.
- Alex
@@ -1,29 +0,0 @@
#!/bin/sh
# ValidatePeopleEmails
# Goes through all your People files and checks that the e-mail addresses
# are valid. Useful for bulk e-mailing where one bad address will make
# the SMTP mail server reject the whole lot.
# By mmu_man, September 18 2003, inspired by Dane's request, used with
# permission in MDR.
query -a 'META:email==*' | xargs catattr META:email >/tmp/PeopleListTemp
cat /tmp/PeopleListTemp | while read LINE; do
NULLATTR="${LINE#* : string :}"
if [ "x$NULLATTR" = "x" ]; then
echo "WARNING: no email address in $LINE"
continue
fi
PPLFILE="${LINE% : string : *}"
PPL="${PPLFILE##*/}"
THEMAIL="${LINE##* : string : }"
FILTERED="$(echo "$THEMAIL" | sed 's/[A-Za-z0-9.+_-]*\@[A-Za-z0-9._-]*/GOOD/' )"
echo "[$PPL] [$THEMAIL] $FILTERED"
if [ "x$FILTERED" != "xGOOD" ]; then
echo "WARNING: strange email for '$PPL': <$THEMAIL>"
fi
done
sed 's/ $/<--Blanks at the end of the e-mail, BAD!/' </tmp/PeopleListTemp >/tmp/PeopleListOut
sed 's/: string :<--Blanks at the end/No e-mail/' </tmp/PeopleListOut >/tmp/PeopleListBlanked
grep "Blanks at the end" /tmp/PeopleListBlanked
@@ -1,283 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><HTML>
<HEAD>
<TITLE>
Networking : E-mail Preferences</TITLE>
</HEAD>
<BODY background="../art/bodyBack.gif" link="#550033">
<A NAME="pgfId-31290"></A><A NAME="98309"></A><H2><FONT FACE="helvetica" COLOR="#550033">
<A HREF="index.html">Networking</A>
</FONT></H2>
<P>
<H1><IMG SRC="../art/goldBack.gif"><FONT SIZE="+5">
E-mail Preferences</FONT>
<A HREF="http://www.be.com"><IMG SRC="../art/eyeBack.gif" BORDER=0 ALIGN="right"></A>
</H1>
<P>
<BR>
<BR>
<BR>
<P CLASS="body">
<A NAME="pgfId-33860"></A>You set up your e-mail environment in the <B><FONT SIZE="+1">E-mail</FONT></b>
preferences. To launch <B><FONT SIZE="+1">E-mail</FONT></b>,
click on the Be logo, open the <B><FONT SIZE="+1">Preferences</FONT></b>
item, and click on <B><FONT SIZE="+1">E-mail</FONT></b>
:</P>
<P CLASS="body">
<A NAME="pgfId-33864"></A>&nbsp;</P>
<IMG SRC="art/EmailPref.gif">
<P CLASS="body">
<A NAME="pgfId-31336"></A> When you launch <B><FONT SIZE="+1">E-mail</FONT></b>,
this is what you see:</P>
<IMG SRC="art/main.png">
<P CLASS="body">
<A NAME="pgfId-31340"></A>When you get to this section, select Add to make a new e-mail account</P>
<BR>
<HR noshade>
<br>
<H2><FONT size=+3>
<A NAME="pgfId-31342"></A>Account Info</FONT></H2>
<IMG SRC="art/new.png">
<P CLASS="body">
You must select the format Inbound and Outbound from the Account type menu before preceeding
</p><A NAME="pgfId-31349"></a>
<p class="body">
<FONT FACE=helvetica color="#550088">
<b>Account Name</b></font> Whatever you wish your e-mail account to be called.</p>
<p class="body">
<FONT FACE=helvetica color="#550088">
<b>Real Name</b></font> Your name.</p>
<p class="body">
<FONT FACE=helvetica color="#550088">
<b>Return Adress</b></font> Your return e-mail adress</p>
</p>
<br>
<hr noshade>
<br>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>POP3/IMAP</b></font>
This lets you set your e-mail type. It is probably POP
</p>
<p class="body">
<A NAME="pgfId-31343"></A><img src="art/incoming.png"><br> <b><FONT FACE=helvetica color="#550088">User Name</FONT></b>.
Your User name is usually the first part of your e-mail address-- it's the &quot;user&quot; in &quot;[email protected]&quot;.
</P>
<P CLASS="body">
<A NAME="pgfId-31347"></A><b><FONT FACE=helvetica color="#550088">Password</FONT></b>.
If you don't enter a password, you're asked for one whenever you make a mail connection. </P>
<P CLASS="body">
<A NAME="pgfId-31348"></A><b><FONT FACE=helvetica color="#550088">POP host</FONT></b>
This is the Internet domain names or IP addresse of the servers that handle your incoming mail. If this is not set, you will not be able to receive incoming mail.</P>
<p class="body">
<b><FONT FACE=helvetica color="#550088">Authenticiation Method (POP Only)</b></font>
This is the method of security your mail provider uses. Its probably plain text, but they can tell you if its not.</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>Folder (IMAP Only)</b></font>
This lets you specify the IMAP folder you are using on the server. Its probably INBOX</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>Leave Mail On Server</b></font>
This option leaves your e-mail on the server, so it can be downloaded again later.</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>Delete Mail From Server when Deleted Locally</b></font>
This option works with the previous one. It removes mail from the server when you delete it on your own machine</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>New Mail Notification Method</b><font>
Lets you select which method is used to alert you to a new e-mail arriving</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>Inbox Destination Folder</b></font>
Lets you specify your inbox. You should leave it at /boot/home/mail/in, and you <b>must not</b> place it off /boot, especially not off a BeOS partition.</p>
<br>
<hr noshade>
<br>
<h2><font size=+3>
Outgoing</font></h2>
<img src="art/Outgoing.png">
<p class="body">
<FONT FACE=helvetica color="#550088"><b>Source Folder</b></font>
The folder from which mails to be sent are taken. You should not change this.</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>SMTP Host</b></font>
The outgoing server of your e-mail provider. If this is not set, this account cannot send e-mails.</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>User Name</b></font>
Your SMTP user name. Usually not nessacery, usually greyed out</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>Password</b></font>
Your SMTP password. Usually not nessacery, usually greyed out</p>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>Authenticiation Method</b></font>
This is where you select your authenticiation method. There is: <b>None</b> (most common), <b>ESMTP</b> (encrypted, rare), and <b>POP3 Before SMTP</b> (slightly more common than ESMTP). The second one needs the password box filled in
<BR>
<HR noshade>
<br>
<H2><FONT size=+3>
<A NAME="pgfId-31359"></A>Retrieval Frequency</FONT></H2>
<IMG SRC="art/retrieval.png">
<P CLASS="body">
<A NAME="pgfId-31360"></A>These menus let you set how often the system should check for incoming mail, and send new outgoing messages. During the check, new incoming messages are downloaded from the POP host to your computer, and outgoing messages are uploaded from your computer to the SMTP host.
</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<IMG SRC="../art/warningBack.gif">
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<A NAME="pgfId-31371"></A>If you connect to your network through <B><FONT SIZE="+1">Dial-up Networking</FONT></b>,
checking mail may automatically start a PPP connection, unless you check "Only when PPP is active"</LI>
</TD>
</TR>
</TABLE>
<BR>
<HR noshade>
<br>
<H2><FONT size=+3>
<A NAME="pgfId-31372"></A>Mail Notification</FONT></H2>
<IMG SRC="art/status.png">
<P CLASS="body">
<A NAME="pgfId-31373"></A>Check <b><FONT FACE=helvetica color="#550088">Show status window</FONT></b>
to put a <b><FONT FACE=helvetica color="#550088">Mail Status</FONT></b>
window on your desktop (shown below).
</P>
<P CLASS="body">
<b><FONT FACE=helvetica color="#550088">Window Look</FONT></b>.
Changes the appearance of the Status window</P>
<P CLASS="body">
<b><FONT FACE=helvetica color="#550088">Window Visible On</FONT></b>.
Selects which workspaces to show the Window on</P>
<P CLASS="body">
<A NAME="pgfId-31379"></A>The <b><FONT FACE=helvetica color="#550088">Mail Status</FONT></b>
This window shows you what the Mail Daemon is doing right now. When downloading or uploading mail, it gives you an e-mail count and a kilobyte size count.
</P>
<IMG SRC="art/activestatus.png">
<br>
<hr noshade>
<br>
<H2><FONT size=+3>
</A>Misc</FONT></H2>
<p class="body">
<FONT FACE=helvetica color="#550088"><b>Auto-start the Mail_Daemon.</b></font> If this is not ticked, you should tick it now. It loads the mail_daemon at boot, and launches the deskbar icon for the Daemon.</p>
<BR>
<HR noshade>
<br>
<H2><FONT size=+3>
<A NAME="pgfId-31383"></A>All Done</FONT></H2>
<P CLASS="body">
<A NAME="pgfId-31384"></A>When you finish configuring mail preferences, click <b><FONT FACE=helvetica color="#550088">Save</FONT></b>
in the <b><FONT FACE=helvetica color="#550088">E-mail window</FONT></b>.
Click <b><FONT FACE=helvetica color="#550088">Check Now</FONT></b>
to check for new messages immediately.</P>
<BR>
<HR noshade>
<br>
<H2><FONT size=+3>
<A NAME="pgfId-31387"></A><A NAME="42370"></A>Mailboxes</FONT></H2>
<P CLASS="body">
<A NAME="pgfId-31388"></A>The BeOS defines the <TT>/boot/home/mail</tt>
directory as the repository for mail. Incoming mail messages are placed in <TT>/boot/home/mail/in</tt>.
Messages that you send are placed in <TT>/boot/home/mail/out</tt>.
If you create your own &quot;mailbox&quot; folders--into which you sort your incoming mail, for example--you're encouraged to place them in <TT>/boot/home/mail</tt>
alongside the folders that Be creates.</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<IMG SRC="../art/infoBack.gif">
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<A NAME="pgfId-31396"></A>The mail folders aren't created until you receive or send mail.</H6>
</TD>
</TR>
</TABLE>
<P CLASS="body">
<A NAME="pgfId-31397"></A>The easiest way to open one of the mailbox folders is to pop up the mailbox icon's context menu (in <B><FONT SIZE="+1">Deskbar</FONT></b>'s <b><FONT FACE=helvetica color="#550088">Status View</FONT></b>).
</P>
<IMG SRC="art/mailPopup.gif">
<P CLASS="body">
<A NAME="pgfId-31402"></A><b><FONT FACE=helvetica color="#550088">Open Inbox</FONT></b>
opens the incoming mail folder in a <B><FONT SIZE="+1">Tracker</FONT></b>
window. </P>
<P CLASS="body">
<A NAME="pgfId-31403"></A><b><FONT FACE=helvetica color="#550088">Open Mail Folder</FONT></b>
opens the <TT>/boot/home/mail</tt>
folder.</P>
<P CLASS="body">
<A NAME="pgfId-31404"></A>Any Tracker folder window that contains an e-mail message is automatically given extra e-mail attributes that you can see when you put the window in <b><FONT FACE=helvetica color="#550088">List View</FONT></b>
mode. </P>
<IMG SRC="art/emailAttrs.gif">
<P CLASS="body">
<A NAME="pgfId-31408"></A>The <b><FONT FACE=helvetica color="#550088">Status</FONT></b>
of an e-mail message is either <b><FONT FACE=helvetica color="#550088">New</FONT></b>
or <b><FONT FACE=helvetica color="#550088">Read</FONT></b>
(for in-coming messages), or <b><FONT FACE=helvetica color="#550088">Pending</FONT></b>
or <b><FONT FACE=helvetica color="#550088">Sent</FONT></b>
(for out-going). The <b><FONT FACE=helvetica color="#550088">Priority</FONT></b>
attribute is provided as a convenience--you can set an e-mail's priority to whatever you want. The values of the rest of the e-mail attributes are taken from the message itself.</P>
<H3 CLASS="head1">
<A NAME="pgfId-31410"></A><A NAME="19818"></A>Sending and Receiving Mail Messages</H3>
<P CLASS="body">
<A NAME="pgfId-31411"></A>There are a number of ways to check for new mail:</P>
<LI CLASS="bulletTight">
<A NAME="pgfId-31412"></A>Wait for the system to perform its automated check.</LI>
<LI CLASS="bulletTight">
<A NAME="pgfId-31413"></A>Press <b><FONT FACE=helvetica color="#550088">Check Now</FONT></b>
in the <b><FONT FACE=helvetica color="#550088">Mail Status</FONT></b>
window.</LI>
<LI CLASS="bulletTight">
<A NAME="pgfId-31414"></A>Choose <b><FONT FACE=helvetica color="#550088">Check Now</FONT></b>
from the mailbox context menu in <B><FONT SIZE="+1">Deskbar</FONT></b>'s <b><FONT FACE=helvetica color="#550088">Status View</FONT></b>.
</LI>
<P CLASS="body">
<A NAME="pgfId-31415"></A>Each of these methods also sends any <b><FONT FACE=helvetica color="#550088">Pending</FONT></b>
out-going mail (messages that you've written but haven't yet sent). </P>
</BODY>
</HTML>
<!-- START: Footer for BeOS 5 HTML User's Guide English-->
<P>
<HR noshade>
<P>
<CENTER>
<a href="../index.html"><IMG src="../art/titleBack.gif" border=0></a>
</CENTER>
<P>
<BR>
<FONT face=helvetiva size="-3">COPYRIGHT &copy; 2000 Be, INC. ALL RIGHTS RESERVED. Enhanced 2003 by Cian Duffy for the Mail Daemon Replacement Team
<P>
<BR>
<BR>
</HTML>
<!-- END: Footer for BeOS 5 HTML User's Guide English-->
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

@@ -1,24 +0,0 @@
NathanW wrote on June 30 2003:
Here's the overview:
ChainRunner:
It's now a BLooper and it goes like this: Running the chain
triggers an 'INIT' message, which causes it to begin to load add-ons.
The constructor of the producer add-on calls ChainRunner's
GetMessages() routine with a list of unique ids to fetch. It then runs
through the list, passing in those, then calls any registered process
callbacks after the list is exhausted. Note that finishing the list *
does not* cause the connection to be terminated and the add-ons to be
destructed. Single pass add-ons (e.g. POP and Outbox) register a
process callback that calls ChainRunner::Stop().
MailProtocol/MailFilter:
No longer sets the unique id, because it's passed in. Calls
GetMessages(), and uses ReportProgress() and ShowError() methods of
ChainRunner instead of using the functions in status.h. Also sets SIZE
attribute in out_headers that contains the final downloaded size of the
message. Also now passed a ChainRunner instead of a StatusView.
That's about it, really.
-Nathan
Binary file not shown.
@@ -1,668 +0,0 @@
<HTML>
<HEAD>
<TITLE>MIMEMultipartContainer</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#2222AA" BACKGROUND="../art/bodyBack.gif">
<P><A NAME=BCursor></A> <!--TOP LINKS--></P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<HR NOSHADE>
</CENTER>
<P><!--TOP LINKS--></P>
<H1><FONT SIZE="+4">MIMEMultipartContainer</FONT></H1>
<BLOCKQUOTE><FONT FACE="helvetica"><B>Derived
from:</B></FONT>&nbsp;<A HREF="MailComponent.html">MailComponent</A><BR>
<FONT FACE="helvetica"><B>Declared in:</B></FONT>&nbsp;
include/public/MailContainer.h<BR>
<FONT FACE="helvetica"><B>Library:</B></FONT>&nbsp;libmail.so<BR>
<P><BR>
</P>
<P>MIMEMultipartContainer uses the RFC 2046 multipart specification to allow you to place
multiple components in a single message. Mostly useful for attachments and things.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">C</FONT><FONT COLOR="#430000">onstructor
and
</FONT><FONT SIZE="+3" COLOR="#430000">D</FONT><FONT COLOR="#430000">estructor</FONT></H2>
<P>
<HR>
<A NAME=MIMEMultipartContainer></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">MIMEMultipartContainer()
</FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<FONT SIZE="+1"><B><TT>MIMEMultipartContainer(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>boundary</I></FONT> = <B>NULL</B>,
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>this_is_an_MIME_message_text</I></FONT> = <B>NULL</B>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Initializes the <B>MIMEMultipartContainer</B>. Sets the boundary between parts to <FONT FACE="HELVETICA" COLOR="#991122"><I>boundary</I></FONT>.
Note that <FONT FACE="HELVETICA" COLOR="#991122"><I>boundary</I></FONT> can be an arbitrary text string but <B>must</B> contain only US-ASCII
characters and be unique to this particular MIMEMultipartContainer. It does not have to be globally unique, however. <FONT FACE="HELVETICA" COLOR="#991122"><I>boundary</I></FONT> must be specified,
either here or through <A HREF="#SetBoundary">SetBoundary()</A>. Also, sets the warning text about &quot;This is an MIME message...&quot; to <FONT FACE="HELVETICA" COLOR="#991122"><I>this_is_an_MIME_message_text</I></FONT>,
which need not be specified at all.</P>
</BLOCKQUOTE>
<P>
<HR>
<A NAME="~MIMEMultipartContainer"></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">~MIMEMultipartContainer()
</FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual
<FONT SIZE="+1"><B><TT>~MIMEMultipartContainer()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Destroys the <B>MIMEMultipartContainer</B>. Note that this deletes all components which may have been added to
this object. The ownership of all components is assumed by <B>MIMEMultipartContainer</B> when they are added.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">M</FONT><FONT COLOR="#430000">ember
</FONT><FONT SIZE="+3" COLOR="#430000">F</FONT><FONT COLOR="#430000">unctions</FONT></H2>
<P>
<HR>
<A NAME=GetDecodedData></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">GetDecodedData () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>GetDecodedData(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns an error. MIMEMultipartComponents don't have data of their own..</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_BAD_TYPE</B> This operation is guranteed to fail.</BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetDecodedData></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetDecodedData () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>SetDecodedData(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns an error. MIMEMultipartComponents don't have data of their own..</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_BAD_TYPE</B> This operation is guranteed to fail.</BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Instantiate></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Instantiate () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Instantiate(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
size_t <FONT FACE="HELVETICA" COLOR="#991122"><I>length</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Does what you would expect. Creates a list of components from <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>. Note that you <B>cannot</B> delete <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>, as we cache
it for later. This is because, as a memory and CPU saving measure, we do not actually instantiate these components until asked to. Thus instantiating an MIMEMultipartContainer is not a
processor or memory-intensive operation.</BLOCKQUOTE>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_BAD_TYPE</B> if <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT FACE="HELVETICA"></FONT> is not an MIME multipart component</P>
</BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Render></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Render () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Render(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Renders the component into RFC 822 format and places the result
in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position().</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- Something else in the event of failure.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetBoundary></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetBoundary() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetBoundary(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>boundary</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the boundary between parts to <FONT FACE="HELVETICA" COLOR="#991122"><I>boundary</I></FONT>.
Note that <FONT FACE="HELVETICA" COLOR="#991122"><I>boundary</I></FONT> can be an arbitrary text string but <B>must</B> contain only US-ASCII
characters and be unique to this particular MIMEMultipartContainer. It does not have to be globally unique, however.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetThisIsAnMIMEMessageText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetThisIsAnMIMEMessageText() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetThisIsAnMIMEMessageText(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the warning text about &quot;This is an MIME message...&quot; to <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>,
which need not be specified at all. We reccomend that it only be set in the top-most <B>MIMEMultipartContainer</B> of the message.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=AddComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">AddComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>
void <FONT SIZE="+1"><B><TT>AddComponent(</TT></B></FONT>
<A HREF="MailComponent.html">MailComponent</A> *<FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Adds <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT> to this MIMEMultipartContainer. Note that the MIMEMultipartContainer
assumes ownership of <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>. Thus, you <B>may not</B> delete <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>.
If you continue to modify to it after calling <A HREF="#AddComponent">AddComponent()</A>, your changes will be reflected when you
call <A HREF="#Render">Render()</A>.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=GetComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">GetComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>
<A HREF="MailComponent.html">MailComponent</A> * <FONT SIZE="+1"><B><TT>GetComponent(</TT></B></FONT>
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>.
Instantiate()s it if it has not yet been instantiated. Otherwise, returns already instantiated
component. Use RTTI or <A HREF="MailComponent.html">MailComponent</A> hooks to do useful things with the returned
component.</P>
<P>&nbsp;</P>
<P></BLOCKQUOTE>
<HR>
<A NAME=CountComponents></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">CountComponents() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>
int32 <FONT SIZE="+1"><B><TT>CountComponents()</TT></B></FONT> const</P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the total number of components in this MIMEMultipartContainer.</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=ManualGetComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">ManualGetComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>
status_t <FONT SIZE="+1"><B><TT>ManualGetComponent(</TT></B></FONT>
<A HREF="MailComponent.html">MailComponent</A> * <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>,
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Attempts to Instantiate() <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT> from the component at
<FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>. Note that this will fail either if <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>->Instantiate() fails
or if the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> either does not exist or exists only as a <A HREF="MailComponent.html">MailComponent</A> and not as a raw buffer. In other words,
this function will succeed if and only if the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> exists, was part of the message
when this MIMEMultipartContainer was instantiated and has not been written over since then, and <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>->Instantiate() succeeds on this buffer.
<FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT> must be a valid <A HREF="MailComponent.html">MailComponent</A>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_BAD_INDEX</B> if <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> is out of range</P>
<P>- <B>B_NAME_IN_USE</B> if the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> does not exist in raw buffer form</P>
<P>- Something else if <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>->Instantiate() fails.</P>
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=RemoveComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">RemoveComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>
status_t <FONT SIZE="+1"><B><TT>RemoveComponent(</TT></B></FONT>
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Removes the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> from the container and
frees all memory associated with it (i.e. we delete it).</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.<P>
- <B>B_BAD_INDEX</B> if <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> is out of range</P>
</BLOCKQUOTE>
</BLOCKQUOTE>
</TABLE></P>
<P><!--TOP LINKS-->
<HR NOSHADE>
</P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
</CENTER>
<P><!--TOP LINKS--> <!-- Footer for Release 5 HTML Be Book --><BR>
</P>
<CENTER><FONT SIZE="+3" COLOR="#555555"><I>Mail Daemon 2 API
Documentation</I></FONT>
<P><FONT SIZE="+1" COLOR="#555555"><I>&copy;2001 Dr. Zoidberg
Enterprises</I></FONT></P></CENTER>
</BODY>
</HTML>
@@ -1,763 +0,0 @@
<HTML>
<HEAD>
<TITLE>MailComponent</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#2222AA" BACKGROUND="../art/bodyBack.gif">
<P><A NAME=BCursor></A> <!--TOP LINKS--></P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<HR NOSHADE>
</CENTER>
<P><!--TOP LINKS--></P>
<H1><FONT SIZE="+4">MailComponent</FONT></H1>
<BLOCKQUOTE><FONT FACE="helvetica"><B>Derived
from:</B></FONT>&nbsp;none<BR>
<FONT FACE="helvetica"><B>Declared in:</B></FONT>&nbsp;
include/public/MailComponent.h<BR>
<FONT FACE="helvetica"><B>Library:</B></FONT>&nbsp;libmail.so<BR>
<P><BR>
</P>
<P>MailComponent is the base class for the vast majority of the
public Mail Kit. It is, however, important to remember that
MailComponent is not abstract, and is useful by itself. A
MailComponent has the important quality of being able to read the
headers of a message or component without instantiating whatever
massive quantity of data might lie therein. This is useful
primarily to determine the kind of data you are dealing with, so
that the user can make a decision as to whether it should be
shown.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">C</FONT><FONT COLOR="#430000">onstructor
and
</FONT><FONT SIZE="+3" COLOR="#430000">D</FONT><FONT COLOR="#430000">estructor</FONT></H2>
<P>
<HR>
<A NAME=MailComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">MailComponent()
</FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P><FONT SIZE="+1"><B><TT>MailComponent()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Initializes the MailComponent and does nothing else.</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P>
<HR>
<A NAME="~MailComponent"></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">~MailComponent()
</FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual
<FONT SIZE="+1"><B><TT>~MailComponent()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Destroys the MailComponent. Does nothing of interest.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">H</FONT><FONT COLOR="#430000">ook
</FONT><FONT SIZE="+3" COLOR="#430000">F</FONT><FONT COLOR="#430000">unctions</FONT></H2>
<P>
<HR>
<A NAME=GetDecodedData></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">GetDecodedData () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>GetDecodedData(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Retrieves the data contained in this component in canonical
format and places this data in<FONT FACE="HELVETICA" COLOR="#991122"><I>
data</I></FONT>. The various attachments subclasses implement this
function to return decoded data, and PlainTextBodyComponent
returns UTF8 text. MailComponent implements this function to do
nothing and return <B>B_OK</B>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- Something else in the event of failure.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetDecodedData></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetDecodedData () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>SetDecodedData(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the content of this component to the canonical format data
contained in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>.
Thus, an attachment subclass would accept a file here and encode
it into the specified encoding. MailComponent implements this
function to do nothing and return <B>B_OK</B>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- Something else in the event of failure.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Instantiate></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Instantiate () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Instantiate(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
size_t <FONT FACE="HELVETICA" COLOR="#991122"><I>length</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Initializes this component to the RFC 822 format data in
<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position(), for up to <FONT FACE="HELVETICA" COLOR="#991122"><I>length
</I></FONT>bytes. Note that if you implement this function, your
subclass may have taken up some of your data. As such, cache the
position of <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>before calling your parent's version of
<FONT SIZE="+1"><B><TT>Instantiate()</TT></B></FONT>, and then
subtract the difference between the new position and your cached
value, like this:</P>
<BLOCKQUOTE><CODE>off_t cache = data-&gt;Position();<BR>
MailComponent::Instantiate(data,length);<BR>
length -= (data-&gt;Position() - cache);</CODE></BLOCKQUOTE>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_BAD_TYPE</B> if we cannot handle <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT FACE="HELVETICA">.</FONT></P>
<P>- Something else in the event of another kind of
failure.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Render></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Render () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Render(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Renders the component into RFC 822 format and places the result
in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position().</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- Something else in the event of failure.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=MIMEType></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">MIMEType () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>MIMEType(</TT></B></FONT>BMimeType
*<FONT FACE="HELVETICA" COLOR="#991122"><I>mime</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Places the MIME type of the data into <FONT FACE="HELVETICA" COLOR="#991122"><I>mime</I></FONT>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- Something else in the event of failure.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">M</FONT><FONT COLOR="#430000">ember
</FONT><FONT SIZE="+3" COLOR="#430000">F</FONT><FONT COLOR="#430000">unctions</FONT></H2>
<P>
<HR>
<A NAME=WhatIsThis></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">WhatIsThis() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>MailComponent*
<FONT SIZE="+1"><B><TT>WhatIsThis()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Employs simple heuristics such as the MIME type to present you
with an instance of a useful subclass of MailComponent. You can
then use any of MailComponent's hook functions or RTTI calls to
get more information. Bear in mind that the returned component is
<I>not</I> set to any data. You must still <A HREF="#Instantiate">Instantiate()</A>
it from whatever data this object was instantiated from.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=IsAttachment></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">IsAttachment() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>bool
<FONT SIZE="+1"><B><TT>IsAttachment()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Employs simple heuristics such as the MIME type and the
Content-Disposition: header to determine whether this component is
an attachment. Returns <B>true</B> if it is an attachment,
<B>false</B> if not.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetHeaderField></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetHeaderField() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetHeaderField(</TT></B></FONT>
<BLOCKQUOTE>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT>,<BR>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>value</I></FONT>,<BR>
uint32 <FONT FACE="HELVETICA" COLOR="#991122"><I>charset</I></FONT> = <B>B_ISO1_CONVERSION</B>,<BR>
mail_encoding <FONT FACE="HELVETICA" COLOR="#991122"><I>encoding</I></FONT> = <B>quoted_printable</B>,<BR>
bool <FONT FACE="HELVETICA" COLOR="#991122"><I>replace_existing</I></FONT>= <B>true</B>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P></BLOCKQUOTE>
</TD>
</TR>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetHeaderField(</TT></B></FONT>
<BLOCKQUOTE>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT>,<BR>
BMessage *<FONT FACE="HELVETICA" COLOR="#991122"><I>structured_header</I></FONT>,<BR>
bool <FONT FACE="HELVETICA" COLOR="#991122"><I>replace_existing</I></FONT>= <B>true</B>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P></BLOCKQUOTE>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Adds the specificed header of type <FONT FACE="HELVETICA" COLOR="#991122"><I>key
</I></FONT>and with the UTF8 contents <FONT FACE="HELVETICA" COLOR="#991122"><I>value</I></FONT>
to the component.
<FONT SIZE="+1"><B><TT>SetHeaderField()</TT></B></FONT> converts
any 8 bit data in <FONT FACE="HELVETICA" COLOR="#991122"><I>value</I></FONT>
to <FONT FACE="HELVETICA" COLOR="#991122"><I>charset</I></FONT>
(see the Support Kit on UTF8 for more information on this), and
encodes it into 7 bit data using <FONT FACE="HELVETICA" COLOR="#991122"><I>encoding</I></FONT>.
If <FONT FACE="HELVETICA" COLOR="#991122"><I>replace_existing</I></FONT>
is true, replaces any existing header of this type with this one,
otherwise adds a second one.</P>
<P>Thus, to set the header <CODE>To:</CODE> of some <B>MailComponent</B> <I>component</I> to [email protected], we would do this:</P>
<BLOCKQUOTE><CODE>
component-&gt;SetHeaderField(&quot;To&quot;,&quot;[email protected]&quot;);
</CODE></BLOCKQUOTE>
<P>The version of the function that takes a BMessage sets a structured header. These are in the format
<CODE>unlabeled; key=value; key=value</CODE>. The most common instance of this is the <CODE>Content-Type</CODE> header,
where the MIME type is unlabeled, and various other information, such as character set, is specified in the
key/value pairs. The format for <FONT FACE="HELVETICA" COLOR="#991122"><I>structured_header</I></FONT> is relatively
simple: simply use <TT>BMessage::AddString(key,value)</TT> for each key/value pair. The only exception to this
rule is the unlabeled data. For this, simply use the key <I>unlabeled</I>. Please note that the <I>charset</I> and <I>encoding</I> arguments
defined for the text version of <TT>SetHeaderField</TT> is not provided here because structured headers cannot be encoded.</P>
<P>Thus, a relatively standard <CODE>Content-Type</CODE> header would be specified as follows:
<BLOCKQUOTE><CODE>
BMessage structured;<BR>
structured.AddString(&quot;unlabeled&quot;,&quot;text/plain&quot;);<BR>
structured.AddString(&quot;charset&quot;,&quot;iso-8859-1&quot;);<BR>
component-&gt;SetHeaderField(&quot;To&quot;,&amp;structured);
</CODE></BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=HeaderField></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">HeaderField() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>HeaderField(</TT></B></FONT>const
char *<FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT>,
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>
=
<B>0</B><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>status_t
<FONT SIZE="+1"><B><TT>HeaderField(</TT></B></FONT>
<BLOCKQUOTE>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT>,<BR>
BMessage *<FONT FACE="HELVETICA" COLOR="#991122"><I>structured_header</I></FONT>,<BR>
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> = <B>0</B>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P></BLOCKQUOTE>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the header <FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT>.
If there is more than one header <FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT>,
use <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> to
iterate through them. In the event that the specified header does
not exist, <FONT SIZE="+1"><B><TT>HeaderField()
</TT></B></FONT>returns <B>NULL</B>. Thus, to retrieve the contents of the <CODE>Subject:</CODE> field in
UTF8 format, you would do this:</P>
<BLOCKQUOTE><CODE>
const char *subject = component-&gt;HeaderField(&quot;Subject&quot;);
</CODE></BLOCKQUOTE>
<P>The version of this function that takes a BMessage
decodes whatever structured header may exist in <FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT>
and places it in <FONT FACE="HELVETICA" COLOR="#991122"><I>structured_header</I></FONT> according to the
format laid out in <A HREF="#SetHeaderField">SetHeaderField()</A>. Returns <B>B_NAME_NOT_FOUND</B>
if the header <FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT> does not exist. If it does exist,
but is not structured, no error is returned; the entire contents of the header are placed in <I>unlabeled</I>.
</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=HeaderAt></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">HeaderAt() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>HeaderAt(</TT></B></FONT>
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the key of the header at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>.
Useful for iterating through all the headers. If <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>
is out of range, <TT>HeaderAt()</TT> returns <B>NULL</B>.</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P></TABLE></P>
<P>
<HR>
<A NAME=RemoveHeader></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">RemoveHeader() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>RemoveHeader(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Removes all headers with the key <FONT FACE="HELVETICA" COLOR="#991122"><I>key</I></FONT>.</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P><!--TOP LINKS-->
<HR NOSHADE>
</P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
</CENTER>
<P><!--TOP LINKS--> <!-- Footer for Release 5 HTML Be Book --><BR>
</P>
<CENTER><FONT SIZE="+3" COLOR="#555555"><I>Mail Daemon 2 API
Documentation</I></FONT>
<P><FONT SIZE="+1" COLOR="#555555"><I>&copy;2001 Dr. Zoidberg
Enterprises</I></FONT></P></CENTER>
</BODY>
</HTML>
-950
View File
@@ -1,950 +0,0 @@
<HTML>
<HEAD>
<TITLE>MailMessage</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#2222AA" BACKGROUND="../art/bodyBack.gif">
<P><A NAME=BCursor></A> <!--TOP LINKS--></P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<HR NOSHADE>
</CENTER>
<P><!--TOP LINKS--></P>
<H1><FONT SIZE="+4">MailMessage</FONT></H1>
<BLOCKQUOTE><FONT FACE="helvetica"><B>Derived
from:</B></FONT>&nbsp;<A HREF="MailComponent.html">MailComponent</A><BR>
<FONT FACE="helvetica"><B>Declared in:</B></FONT>&nbsp;
include/public/MailMessage.h<BR>
<FONT FACE="helvetica"><B>Library:</B></FONT>&nbsp;libmail.so<BR>
<P><BR>
</P>
<P>MailMessage is what you use if you are interested in actually
sending messages. It allows you to add an arbitrary number of
components (naturally making it multipart only if there is more
than one), and provides many convenience functions for adding, modifying
and accessing both headers and data. If you use this kit, you will get to
know MailMessage very well.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">C</FONT><FONT COLOR="#430000">onstructor
and
</FONT><FONT SIZE="+3" COLOR="#430000">D</FONT><FONT COLOR="#430000">estructor</FONT></H2>
<P>
<HR>
<A NAME=MailMessage></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">MailMessage() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P><FONT SIZE="+1"><B><TT>MailMessage(</TT></B></FONT>
BPositionIO *<FONT FACE="HELVETICA" COLOR="#991122"><I>mail_file</I></FONT> = <B>NULL</B>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Creates a new MailMessage. If <FONT FACE="HELVETICA" COLOR="#991122"><I>mail_file</I></FONT> is not <B>NULL</B>,
the MailMessage will be instantiated to the RFC 822 format data contained
in <FONT FACE="HELVETICA" COLOR="#991122"><I>mail_file</I></FONT>.</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P>
<HR>
<A NAME="~MailMessage"></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">~MailMessage() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual
<FONT SIZE="+1"><B><TT>~MailMessage()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Destroys the message, frees internal buffers, and deletes all added
components.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">M</FONT><FONT COLOR="#430000">ember
</FONT><FONT SIZE="+3" COLOR="#430000">F</FONT><FONT COLOR="#430000">unctions</FONT></H2>
<P>
<HR>
<A NAME=To></A>
<A NAME=From></A>
<A NAME=ReplyTo></A>
<A NAME=CC></A>
<A NAME=Subject></A>
<A NAME=Priority></A>
<TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">To (), From (), ReplyTo (), CC (), Subject (), Priority ()</FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>To()</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>From()</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>ReplyTo()</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>CC()</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>Subject()</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>int
<FONT SIZE="+1"><B><TT>Priority()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the relevant header field from the message. These are simply a convenience. <CODE>Subject()</CODE>,
for instance, is equivalent to, and implemented as, <CODE>HeaderField(&quot;Subject&quot;)</CODE>. There is
no <CODE>BCC()</CODE> function because, for obvious reasons, it is impossible to retrieve BCCs from the message.</P>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=SetTo></A>
<A NAME=SetFrom></A>
<A NAME=SetReplyTo></A>
<A NAME=SetCC></A>
<A NAME=SetSubject></A>
<A NAME=SetPriority></A>
<TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetTo (), SetFrom (), SetReplyTo (), SetCC (), SetBCC (), SetSubject (), SetPriority ()</FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetTo(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetFrom(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetReplyTo(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetCC(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetBCC(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetSubject(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetPriority(</TT></B></FONT>
int <FONT FACE="HELVETICA" COLOR="#991122"><I>to</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the relevant header field of the message. With the exception of
<TT>SetBCC()</TT>, these are simply conveniences which can be easily emulated
with <A HREF="MailComponent.html#SetHeaderField">SetHeaderField()</A>.</P>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=SendViaAccount></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SendViaAccount () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SendViaAccount(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>account_name</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SendViaAccount(</TT></B></FONT>
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>chain_id</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the message up so that it is sent via the account specified by either <FONT FACE="HELVETICA" COLOR="#991122"><I>account_name</I></FONT>
or <FONT FACE="HELVETICA" COLOR="#991122"><I>chain_id</I></FONT>, which of course must exist as an outbound chain (see
<A HREF="MailChain.html#ChainDirection">MailChain::ChainDirection()</A> for details). Automatically calls <A HREF="#SetFrom">SetFrom()</A> with
the return address indicated in the specified chain using the format "Real Name" &lt;e-mail&gt;.</P>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=AddComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">AddComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>
void <FONT SIZE="+1"><B><TT>AddComponent(</TT></B></FONT>
<A HREF="MailComponent.html">MailComponent</A> *<FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Adds <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT> to this MailMessage. Note that the MailMessage
assumes ownership of <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>. Thus, you <B>may not</B> delete <FONT FACE="HELVETICA" COLOR="#991122"><I>component</I></FONT>.
If you continue to modify to it after calling <TT>AddComponent()</TT>, your changes will be reflected when you
call <A HREF="#Render">Render()</A>. <TT>AddComponent()</TT> automatically makes the message multipart if there is
more than one component.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=GetComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">GetComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>
<A HREF="MailComponent.html">MailComponent</A> * <FONT SIZE="+1"><B><TT>GetComponent(</TT></B></FONT>
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT>.
Instantiate()s it if it has not yet been instantiated. Otherwise, returns already instantiated
component. Use RTTI or <A HREF="MailComponent.html">MailComponent</A> hooks to do useful things with the returned
component.</P>
<P>&nbsp;</P>
<P></BLOCKQUOTE>
<HR>
<A NAME=CountComponents></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">CountComponents() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>
int32 <FONT SIZE="+1"><B><TT>CountComponents()</TT></B></FONT> const</P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the total number of components in this MailMessage.</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=Attach></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Attach () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>Attach(</TT></B></FONT>
entry_ref *<FONT FACE="HELVETICA" COLOR="#991122"><I>ref</I></FONT>,
bool <FONT FACE="HELVETICA" COLOR="#991122"><I>include_attributes</I></FONT> = <B>true</B>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Attaches <FONT FACE="HELVETICA" COLOR="#991122"><I>ref</I></FONT> to this message. If <FONT FACE="HELVETICA" COLOR="#991122"><I>include_attributes</I></FONT>
is <B>true</B>, uses an <A HREF="AttributedMailAttachment.html">AttributedMailAttachment</A>
instead of a <A HREF="SimpleMailAttachment.html">SimpleMailAttachment</A>. Be aware that is
attached in the state it is in when the message is rendered, not when <TT>Attach()</TT> is
called.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=IsComponentAttachment></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">IsComponentAttachment () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>bool
<FONT SIZE="+1"><B><TT>IsComponentAttachment(</TT></B></FONT>
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>If the component at <FONT FACE="HELVETICA" COLOR="#991122"><I>index</I></FONT> is an attachment of any
kind, returns <B>true</B>, otherwise returns <B>false</B>.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetBodyTextTo></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetBodyTextTo () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetBodyTextTo(</TT></B></FONT>const
char *<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the body of this message to the UTF8 string
contained in <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>.
If no body has been specified through <A HREF="#SetBody">SetBody()</A>,
<TT>SetBodyTextTo()</TT> creates one.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=BodyText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">BodyText () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>BodyText()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the contents of <A HREF="#Body">Body()</A> as a UTF8
string. Returns <B>NULL</B> if no body exists.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetBody></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetBody () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>status_t
<FONT SIZE="+1"><B><TT>SetBody(</TT></B></FONT>
<A HREF="PlainTextBodyComponent.html">PlainTextBodyComponent</A> *<FONT FACE="HELVETICA" COLOR="#991122"><I>body</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the body of this message to <FONT FACE="HELVETICA" COLOR="#991122"><I>body</I></FONT>.
If a body has already been specified, <TT>SetBody()</TT> returns <B>B_ERROR</B>, otherwise
returns <B>B_OK</B>.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=Body></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Body () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P><A HREF="PlainTextBodyComponent.html">PlainTextBodyComponent</A> *
<FONT SIZE="+1"><B><TT>Body()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the body as a <A HREF="PlainTextBodyComponent.html">PlainTextBodyComponent</A> pointer.
Returns <B>NULL</B> if no body exists. This object belongs to the MailMessage, do <I>not</I> delete it.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=Instantiate></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Instantiate () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Instantiate(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
size_t <FONT FACE="HELVETICA" COLOR="#991122"><I>length</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Initializes this message to the RFC 822 format data in
<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position(), for up to <FONT FACE="HELVETICA" COLOR="#991122"><I>length
</I></FONT>bytes.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_BAD_TYPE</B> if <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT FACE="HELVETICA">
</FONT>does not seem to be an e-mail message.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Render></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Render () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Render(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Renders the message into RFC 822 format and places the result
in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position(). If <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>
is a BFile, writes appropriate attributes and sets its MIME type to text/x-email.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.</BLOCKQUOTE>
<P></TABLE></P></BLOCKQUOTE>
<P>
<HR>
<A NAME=RenderTo></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">RenderTo () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>status_t
<FONT SIZE="+1"><B><TT>RenderTo(</TT></B></FONT>BDirectory
*<FONT FACE="HELVETICA" COLOR="#991122"><I>dir</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Creates a new file in <FONT FACE="HELVETICA" COLOR="#991122"><I>dir</I></FONT>, named according to
the following format: &quot;Subject&quot; &lt;To&gt; <I>unique indentifier</I>. Calls
<A HREF="#Render">Render()</A> on the resulting file and writes appropriate attributes.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.</BLOCKQUOTE>
<P></TABLE></P></BLOCKQUOTE>
<P>
<HR>
<A NAME=Send></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Send () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>status_t
<FONT SIZE="+1"><B><TT>Send(</TT></B></FONT>bool
<FONT FACE="HELVETICA" COLOR="#991122"><I>send_now</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Calls <A HREF="#RenderTo">RenderTo()</A> with the directory specified by the <A HREF="MailChain.html">MailChain</A>
passed to <A HREF="#SendViaAccount">SendViaAccount()</A>. If that is invalid, it uses the default outbound chain
given by <A HREF="MailSettings.html#DefaultOutboundChainID">MailSettings::DefaultOutboundChainID()</A>. After
rendering the message, if <FONT FACE="HELVETICA" COLOR="#991122"><I>send_now</I></FONT> is <B>true</B>,
calls <A HREF="MailDaemon.html#SendQueuedMail">MailDaemon::SendQueuedMail()</A>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.<P>
- <B>B_MAIL_NO_DAEMON</B> if the mail daemon is not running.<P>
- something else if there is another error.</BLOCKQUOTE>
<P></TABLE></P></BLOCKQUOTE>
<P><!--TOP LINKS-->
<HR NOSHADE>
</P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
</CENTER>
<P><!--TOP LINKS--> <!-- Footer for Release 5 HTML Be Book --><BR>
</P>
<CENTER><FONT SIZE="+3" COLOR="#555555"><I>Mail Daemon 2 API
Documentation</I></FONT>
<P><FONT SIZE="+1" COLOR="#555555"><I>&copy;2001 Dr. Zoidberg
Enterprises</I></FONT></P></CENTER>
</BODY>
</HTML>
@@ -1,614 +0,0 @@
<HTML>
<HEAD>
<TITLE>PlainTextBodyComponent</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#2222AA" BACKGROUND="../art/bodyBack.gif">
<P><A NAME=BCursor></A> <!--TOP LINKS--></P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<HR NOSHADE>
</CENTER>
<P><!--TOP LINKS--></P>
<H1><FONT SIZE="+4">PlainTextBodyComponent</FONT></H1>
<BLOCKQUOTE><FONT FACE="helvetica"><B>Derived
from:</B></FONT>&nbsp;<A HREF="MailComponent.html">MailComponent</A><BR>
<FONT FACE="helvetica"><B>Declared in:</B></FONT>&nbsp;
include/public/MailComponent.h<BR>
<FONT FACE="helvetica"><B>Library:</B></FONT>&nbsp;libmail.so<BR>
<P><BR>
</P>
<P>PlainTextBodyComponent stores plain text. It uses UTF8 text as
its canonical format and reads and writes RFC 2047 style text. As
such, it handles accents and other 8 bit characters with ease. If
you want to send text, this is the way to go.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">C</FONT><FONT COLOR="#430000">onstructor
and
</FONT><FONT SIZE="+3" COLOR="#430000">D</FONT><FONT COLOR="#430000">estructor</FONT></H2>
<P>
<HR>
<A NAME=PlainTextBodyComponent></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">PlainTextBodyComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P><FONT SIZE="+1"><B><TT>PlainTextBodyComponent(</TT></B></FONT>const
char*<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>
=
<B>NULL</B><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Initializes the component and sets its content to <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>,
which can be NULL. The argument is a UTF8 null-terminated string.
Encoding defaults to quoted printable with the ISO-8859-1
charset.</P>
<P>&nbsp;</P></BLOCKQUOTE>
<P>
<HR>
<A NAME="~PlainTextBodyComponent"></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">~PlainTextBodyComponent() </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual
<FONT SIZE="+1"><B><TT>~PlainTextBodyComponent()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Destroys the component and frees internal buffers. Does nothing
of interest.</P></BLOCKQUOTE>
<P>
<HR NOSHADE>
</P>
<H2><FONT SIZE="+3" COLOR="#430000">M</FONT><FONT COLOR="#430000">ember
</FONT><FONT SIZE="+3" COLOR="#430000">F</FONT><FONT COLOR="#430000">unctions</FONT></H2>
<P>
<HR>
<A NAME=GetDecodedData></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">GetDecodedData () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>GetDecodedData(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Retrieves the data contained in this component as a UTF8 string
and places the contents of this string in<FONT FACE="HELVETICA" COLOR="#991122"><I>
data</I></FONT>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_ERROR<I> </I></B>if something goes wrong.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Text></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Text () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>const char *
<FONT SIZE="+1"><B><TT>Text()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the contents of this component as a UTF8
string.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=BStringText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">BStringText () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>BString *
<FONT SIZE="+1"><B><TT>BStringText()</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Returns the internal UTF8 format BString used by this component.
As such, you can do raw text operations on the content of the message. The use of
this function is not reccomended.</P>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=Quote></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Quote () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>Quote(</TT></B></FONT>
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>message</I></FONT> = <B>NULL</B>,
const char *<FONT FACE="HELVETICA" COLOR="#991122"><I>quote_style</I></FONT> = <B>&quot;&gt;&nbsp;&quot;</B>
<FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Quotes the contents of this component. Inserts <FONT FACE="HELVETICA" COLOR="#991122"><I>quote_style</I></FONT> at the start of every line,
and prefaces the content with <FONT FACE="HELVETICA" COLOR="#991122"><I>message</I></FONT>, if it is not NULL. <FONT FACE="HELVETICA" COLOR="#991122"><I>message</I></FONT>
should be something like &quot;On September 30, 2001, John Smith said:&quot;, or something in that vein. Note that the new line after <FONT FACE="HELVETICA" COLOR="#991122"><I>message</I></FONT>
is supplied for you, so you do not need to add it.</P>
</BLOCKQUOTE>
<P>
<HR>
<A NAME=SetDecodedData></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetDecodedData () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>SetDecodedData(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the contents of this component to the UTF8 format data
contained in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_ERROR<I> </I></B>if something goes wrong.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=SetText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetText () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetText(</TT></B></FONT>const
char *<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the contents of this component to the UTF8 string
contained in <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=AppendText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">AppendText () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>AppendText(</TT></B></FONT>const
char *<FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Appends <FONT FACE="HELVETICA" COLOR="#991122"><I>text
</I></FONT>to the current contents of this component. <FONT FACE="HELVETICA" COLOR="#991122"><I>text</I></FONT>
should be a UTF8 string.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=AppendText></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">SetEncoding () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>void
<FONT SIZE="+1"><B><TT>SetEncoding(</TT></B></FONT>mail_encoding
<FONT FACE="HELVETICA" COLOR="#991122"><I>encoding</I></FONT>,
int32 <FONT FACE="HELVETICA" COLOR="#991122"><I>charset</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Sets the encoding and charset used by <A HREF="#Render"><B>Render()</B></A>
to <FONT FACE="HELVETICA" COLOR="#991122"><I>encoding</I></FONT>
and <FONT FACE="HELVETICA" COLOR="#991122"><I>charset</I></FONT>,
respectively. Use the conversion constants from <B>UTF8.h</B> for
<FONT FACE="HELVETICA" COLOR="#991122"><I>charset</I></FONT>. We
<I>strongly</I> reccomend that you always use the defaults for the
reasons outlined in <A HREF="http://www.faqs.org/rfcs/rfc2047.html">RFC
2047</A>.</P></BLOCKQUOTE>
<P>
<HR>
<A NAME=Instantiate></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Instantiate () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Instantiate(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
size_t <FONT FACE="HELVETICA" COLOR="#991122"><I>length</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Initializes this component to the RFC 822 format data in
<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position(), for up to <FONT FACE="HELVETICA" COLOR="#991122"><I>length
</I></FONT>bytes. Handles encoded data according to RFC 2047</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.
<P>- <B>B_BAD_TYPE</B> if <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT FACE="HELVETICA">
</FONT>does not seem to be plain text.</P></BLOCKQUOTE></BLOCKQUOTE>
<P>
<HR>
<A NAME=Render></A><TABLE>
<TR>
<TD>
<P></P>
</TD>
<TD>
<P><FONT SIZE="+2">Render () </FONT></P>
</TD>
</TR>
</TABLE>
</P>
<P>&nbsp;</P>
<BLOCKQUOTE><TABLE BORDER=2 BGCOLOR="#550033" WIDTH=1000>
<TR>
<TD>
<P><TABLE BORDER=1 BGCOLOR="#FFFFFF" CELLPADDING=8 WIDTH=1000>
<TR>
<TD>
<P>virtual status_t
<FONT SIZE="+1"><B><TT>Render(</TT></B></FONT>BPositionIO
*<FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT><FONT SIZE="+1"><B><TT>)</TT></B></FONT></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
<P>Renders the component into RFC 822 format and places the result
in <FONT FACE="HELVETICA" COLOR="#991122"><I>data</I></FONT>,
starting at <FONT FACE="HELVETICA" COLOR="#991122"><I>data
</I></FONT>-&gt;Position(). Encodes and translates charsets
according to the arguments passed to <A HREF="#SetEncoding"><B>SetEncoding()</B></A>.
Encoding defaults to quoted printable and charset to
ISO-8859-1.</P>
<P><B>Return Value:</B></P>
<BLOCKQUOTE>- <B>B_OK</B> if everything succeeds.</BLOCKQUOTE>
<P></TABLE></P></BLOCKQUOTE>
<P><!--TOP LINKS-->
<HR NOSHADE>
</P>
<CENTER><TABLE BORDER=2 BGCOLOR="#FFDD88">
<TR>
<TD>
<P><TABLE BGCOLOR="#550033" CELLPADDING=5>
<TR>
<TD>
<P><A HREF="../index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>Mail
Kit 2 Root</B></FONT></A></P>
</TD>
<TD>
<P><A HREF="index.html"><FONT FACE="HELVETICA" COLOR="#FFFFFF"><B>The
Public API</B></FONT></A></P>
</TD>
</TR>
</TABLE>
</P>
</TD>
</TR>
</TABLE>
</CENTER>
<P><!--TOP LINKS--> <!-- Footer for Release 5 HTML Be Book --><BR>
</P>
<CENTER><FONT SIZE="+3" COLOR="#555555"><I>Mail Daemon 2 API
Documentation</I></FONT>
<P><FONT SIZE="+1" COLOR="#555555"><I>&copy;2001 Dr. Zoidberg
Enterprises</I></FONT></P></CENTER>
</BODY>
</HTML>
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,99 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<!-- Page Design: Susan Fell Johnson, Computer Analyst, Hormel Foods Corporation -->
<!-- Copyright: 2003 Hormel Foods, Inc. -->
<!-- Last Revised: 18 April 2003 -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>RE: SPAM: SPAM and the Internet</TITLE>
<!-- Place JavaScript functions here -->
<SCRIPT LANGUAGE="JavaScript">
<!-- hide this script from non-javascript-enabled browsers
function itWinOpen() {
open("../it.htm","SPAMInTime","toolbar=no,resizable=no,width=587,height=335");
}
// stop hiding -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#3300CC" VLINK="#FF6600" ALINK="#3300CC" TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
<CENTER>
<TABLE WIDTH="585" BORDER="0" CELLSPACING="0" CELLPADDING="0" COLSPAN="3">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="358" COLSPAN="2"> <IMG SRC="../assets/ci/ci_in_a1.gif" ALIGN=LEFT WIDTH="358" HEIGHT="106" BORDER="0" HSPACE="0" VSPACE="0" USEMAP="#ci">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="227" ROWSPAN="2"> <IMG SRC="../assets/ci/ci_in_a2.gif" ALIGN=LEFT WIDTH="227" HEIGHT="158" BORDER="0" HSPACE="0" VSPACE="0" USEMAP="#nav">
</TD>
</TR>
<TR>
<TD WIDTH="35">
<IMG SRC="../assets/shared/trans.gif" ALIGN=LEFT WIDTH="35" HEIGHT="1" BORDER="0" HSPACE="0" VSPACE="0">
</TD>
<TD WIDTH="323">
<P>&nbsp;
<BR>
<FONT SIZE="+2" COLOR="#FF0000"><B><TT>SPAM</TT> <TT>and</TT> <TT>the</TT> <TT>Internet</TT></B></FONT>
<P>
You've probably seen, heard or even used the term "spamming" to refer to the act of sending unsolicited commercial email (UCE), or "spam" to refer to the UCE itself. Following is our position on the relationship between UCE and our trademark SPAM.
<P>
Use of the term "spam" was adopted as a result of the Monty Python skit in which a group of Vikings sang a chorus of "spam, spam, spam . . . " in an increasing crescendo, drowning out other conversation. Hence, the analogy applied because UCE was drowning out normal discourse on the Internet.
<P>
We do not object to use of this slang term to describe UCE, although we do object to the use of our product image in association with that term. Also, if the term is to be used, it should be used in all lower-case letters to distinguish it from our trademark SPAM, which should be used with all uppercase letters.
<P>
This slang term does not affect the strength of our trademark SPAM. In a Federal District Court case involving the famous trademark STAR WARS owned by LucasFilms, the Court ruled that the slang term used to refer to the Strategic Defense Initiative did not weaken the trademark and the Court refused to stop its use as a slang term. Other examples of famous trademarks having a different slang meaning include MICKEY MOUSE, to describe something as unsophisticated; TEFLON, used to describe President Reagan; and CADILLAC, used to denote something as being high quality.
<P>
<FONT SIZE="+1"><B><TT>Position</TT> <TT>Statement</TT> <TT>on</TT> <TT>"Spamming"</TT></B></FONT>
<P>
We oppose the act of "spamming" or sending UCE. We have never engaged in this practice, although we have been victimized by it. If you have been one of those who has received UCE with a return address using our website address of SPAM.com, it wasn't us. It's easy and commonplace for somebody sending UCE to simply adopt a fake header ID, which disguises the true source of the UCE and makes it appear that it is coming from someone else. If you have or do receive UCE with this header ID, please understand that it didn't come from us.
<P>
<FONT SIZE="+1"><B><TT>Other</TT> <TT>"spam"</TT> <TT>Websites</TT></B></FONT>
<P>
This is the one and only official SPAM Website, brought to you by the makers of the SPAM Family of products. All of the others have been created by somebody else. We are not associated with those other websites and are not responsible for their content. As a Company, we are opposed to content that is obscene, vulgar or otherwise not "family friendly." We support positive family values and you can count on us for "safe surfing" by your children.
<P>
Thank you for visiting the official SPAM Website!<BR>
For more information see <A HREF="../hp/hp_lg.htm"> Legal and Copyright Info</A>
<P>&nbsp;
</TD>
</TR>
</TABLE>
<!----ASCII Navigation-------->
<PRE> <FONT SIZE="-1" COLOR="#FF0000">_________________________________________</FONT><BR><FONT SIZE="-1" COLOR="#009900">&lt;|<A HREF="../index.htm">hom<U>e</U></A><U> &gt; &lt; <A HREF="../sp.htm">SPAM|</A> &gt; &lt; <A HREF="javascript:itWinOpen()">SPAM in time </A>&gt; |&lt; <A HREF="../es.htm">eat SPAM</A> &gt; &lt; <FONT SIZE="-1" COLOR="#FF00CC">|</FONT><A HREF="../ss.htm">S</A></U><A HREF="../ss.htm">PAM stu<U>ff </U></A><U>|&gt; </U></FONT><U></U><BR> <FONT SIZE="-1" COLOR="#FF6600"><U> | </U></FONT><U></U><BR> <FONT SIZE="-1" COLOR="#009900"><U> |&lt; <A HREF="../ci.htm">re: SPAM </A>&gt; </U></FONT><U><FONT SIZE="-1" COLOR="#FF6600">|</FONT></U><U><FONT SIZE="-1" COLOR="#33FFFF"> </FONT></U><BR></PRE>
<!----/ASCII Navigation-------->
<BR>
<FONT SIZE="1" COLOR="#666666">SPAM is a registered trademark of Hormel Foods Corporation.</FONT>
<BR>&nbsp;
<!-- Client Side Maps here --> <MAP NAME="nav">
<AREA SHAPE="rect" COORDS="39,127,226,148" HREF="ci_hf.htm" ALT="Hormel Foods">
<AREA SHAPE="rect" COORDS="148,0,226,42" HREF="../index.htm" ALT="Home">
</MAP> <MAP NAME="ci">
<AREA SHAPE="rect" COORDS="0,0,231,34" HREF="../ci.htm" ALT="Corporate Info">
</MAP>
</CENTER>
</BODY>
</HTML>
-806
View File
@@ -1,806 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>AGMSBayesianSpam Documentation</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="author" CONTENT="Alexander G. M. Smith">
<META NAME="description" CONTENT="Documentation for AGMSBayesianSpam, for classifying incoming e-mail messages as spam (junk mail) or genuine.">
<!--
; $Log: index.html,v $
; Revision 1.11 2003/02/08 21:54:14 agmsmith
; Updated the AGMSBayesianSpamServer documentation to match the current
; version. Also removed the Beep options from the spam filter, now they
; are turned on or off in the system sound preferences.
;
; Revision 1.10 2002/12/16 17:32:43 agmsmith
; Added Alex's settings paragraph. Added screen shot of dangerous
; header filter that deletes things on the server.
;
; Revision 1.9 2002/12/13 22:45:22 agmsmith
; More changes for self training and chi-squared scoring.
;
; Revision 1.8 2002/12/13 22:20:50 agmsmith
; Under construction.
;
; Revision 1.7 2002/11/29 23:42:26 agmsmith
; Describe the word display and what you can do with it.
;
; Revision 1.6 2002/11/29 22:20:02 agmsmith
; Updated version numbers in the text
;
; Revision 1.5 2002/11/28 21:19:41 agmsmith
; Updated to explain how to check for spam without downloading the
; whole message.
;
; Revision 1.4 2002/11/10 20:56:39 agmsmith
; Updated documentation to include MDR installer effects, and added a
; section on the tokenizing experiments.
;
; Revision 1.3 2002/11/06 00:54:47 agmsmith
; Spam definition corrected, with prodding from Ian G.
;
; Revision 1.2 2002/11/05 22:47:30 agmsmith
; Replace UTF-8 copyright symbol with useable token.
;
; Revision 1.1 2002/11/05 22:43:24 agmsmith
; Starting point for the HTML documentation for AGMSBayesianSpam stuff.
;
; Revision 1.5 2002/10/21 21:07:19 agmsmith
; Added references to the original spam detection papers.
;
; Revision 1.4 2002/10/21 20:56:01 agmsmith
; Added hyperlinks for local files, and an explanation of "spam".
;
; Revision 1.3 2002/10/21 20:19:29 agmsmith
; Finished updating instructions for version 1.60, and adding
; lots of screen shots.
;
; Revision 1.2 2002/10/21 02:03:35 agmsmith
; Added log in HTML comments area.
;
; Revision 1.1 2002/10/21 02:00:54 agmsmith
; Initial revision
-->
</HEAD>
<BODY BGCOLOR="WHITE" TEXT="BLACK">
<P><FONT COLOR="MAGENTA">Short: Junk E-Mail Classifier.
<BR>Author: [email protected] (Alexander G. M. Smith)
<BR>Uploader: [email protected] (Alexander G. M. Smith)
<BR>Website: <A HREF="http://members.rogers.com/agmsmith/">http://members.rogers.com/agmsmith/</A>
<BR>Version: 1.77
<BR>Type: internet &amp; network/e-mail
<BR>Requires: BeOS 5.0+
<BR>Related things: <A HREF="http://www.paulgraham.com/spam.html">http://www.paulgraham.com/spam.html</A>, <A HREF="http://radio.weblogs.com/0101454/stories/2002/09/16/spamDetection.html">http://radio.weblogs.com/0101454/stories/2002/09/16/spamDetection.html</A></FONT>
<H1><A NAME="Contents"></A>Table of Contents</H1>
<UL>
<LI><A HREF="#Contents">Table of Contents</A>
<LI><A HREF="#Introduction">Introduction to AGMSBayesianSpam</A>
<LI><A HREF="#Installation">Installation</A>
<LI><A HREF="#Usage">Usage</A>
<UL>
<LI><A HREF="#Reading">Reading E-Mail</A>
<LI><A HREF="#Training">Training</A>
<LI><A HREF="#HidingServer">Hiding the Server Window</A>
<LI><A HREF="#AlexSettings">Alex's Settings</A>
</UL>
<LI><A HREF="#AdvancedUsage">Advanced Usage</A>
<UL>
<LI><A HREF="#CommandLine">Command Line Mode and Scripting</A>
<LI><A HREF="#Spreadsheet">Using a Spreadsheet to Examine Word Statistics</A>
<LI><A HREF="#WordDisplay">Understanding and Using the Word Display</A>
<LI><A HREF="#Tokenizing">Tokenizing Modes Compared</A>
<LI><A HREF="#HeadersOnly">High Speed and High Danger - Headers Only Trick</A>
</UL>
<LI><A HREF="#ChangeLog">Change Log</A>
</UL>
<H1><A NAME="Introduction"></A>Introduction to AGMSBayesianSpam</H1>
<P>AGMSBayesianSpam is a set of BeOS programs for classifying e-mail messages
and other text as either spam or genuine. "Spam" is the colloquial name for
unwanted junk messages, usually advertising. The name comes from a 1970's <A
HREF="http://www.google.com/search?&q=monty+python+spam">Monty Python comedy
skit</A> involving lots of unwanted Spam, which is the name for the spicy ham
in a can made by the <A HREF="http://www.hormel.com/">Hormel Foods</A> company,
originally from Austin, Minnesota, USA. The program classifies messages as
spam or genuine (sometimes called "ham"), based on the words they contain and
previous messages which have been identified by the user as spam or genuine.
It's implemented as a server program (AGMSBayesianSpamServer) which keeps track
of the word list and a Mail Daemon Replacement add-on (AGMSBayesianSpamFilter)
which uses the server to classify incoming messages. Theoretically other
programs, like a news reader, could also use the word database using the
scripting interface. There's also a command line interface and a graphical
user interface.
<P>If you want to know more about the technique of counting words, have a look
at Paul Graham's wonderful write-up at <A
HREF="http://www.paulgraham.com/spam.html">http://www.paulgraham.com/spam.html</A>.
This program is currently using an improved version of Graham's method, called
Gary-combining, by Gary Robinson. See <A
HREF="http://radio.weblogs.com/0101454/stories/2002/09/16/spamDetection.html"
>http://radio.weblogs.com/0101454/stories/2002/09/16/spamDetection.html</A> for
Gary's story. There's also an even more improved method called Chi-Squared
(&chi;&sup2;) combining, which grew from discussions on the <A
HREF="http://mail.python.org/mailman-21/listinfo/spambayes">Spambayes</A>
mailing list.
<H1><A NAME="Installation"></A>Installation</H1>
<OL TYPE="1">
<LI>Install the BeOS Mail Daemon Replacement (MDR) version 2.0.0 beta 7 or
later. Beta 3 and later include AGMSBayesianSpam so you don't need to
worry about incompatible versions, and the MDR will even do some of the
installation for you. You can get MDR from <A
HREF="http://www.bebits.com/app/2289">http://www.bebits.com/app/2289</A> or
get the latest source code and compile it yourself from <A
HREF="http://sourceforge.net/projects/bemaildaemon"
>http://sourceforge.net/projects/bemaildaemon</A>.
<LI>Move the AGMSBayesianSpamServer program to the
<A HREF="file:/boot/home/config/bin/">/boot/home/config/bin/</A> directory
(the MDR installer will do this for you). It's
put there to make it useable from the command line. If you use it
frequently, you can also add a symbolic link to it in your desktop
applications menu or to the mail menu.
<LI>Move the AGMSBayesianSpamFilter mail add-on to the
<A HREF="file:/boot/home/config/add-ons/mail_daemon/inbound_filters/"
>/boot/home/config/add-ons/mail_daemon/inbound_filters/</A> directory
(the MDR installer will do this for you).<BR>
<IMG SRC="pictures/HomeConfigAddonsMaildaemonInboundfilters.png"
ALT="[/boot/home/config/add-ons/mail_daemon/inbound_filters/ directory]"
WIDTH="634" HEIGHT="288">
<LI><IMG SRC="pictures/CantFindSettings.png" ALT="[Can't Find Settings]"
WIDTH="326" HEIGHT="120" ALIGN="RIGHT">Set up MIME types and indices (the
MDR installer will do this step and the next one for you, invisibly). Run
the AGMSBayesianSpamServer program. It will put up an alert box
complaining about not finding the settings file. Just hit the Acknowledge
button to get past it. Then click the "Install MIME Types &amp; Make
Indices on All Drives" button which does what it says plus it also adds a
few sound effect names to the system.<BR CLEAR="ALL">
<IMG SRC="pictures/TheInstallButton.png" ALT="[The Install Button]"
WIDTH="604" HEIGHT="403">
<LI>Quit the program (the close box at the top left corner is one way of
doing that). It will make the settings file and settings directory
<A HREF="file:/boot/home/config/settings/AGMSBayesianSpam/"
>/boot/home/config/settings/AGMSBayesianSpam/</A> when it exits.
<LI>Use the Sounds preferences (or the installsound command) to associate
the names with your sound files (SoundGenuine, SoundUncertain and SoundSpam
are included as examples with MDR in the <A
HREF="file:/boot/home/config/settings/AGMSBayesianSpam/"
>/boot/home/config/settings/AGMSBayesianSpam/</A> directory), no I don't
have the rights to the Monty Python Spam skit). If you don't want it to
make sounds, don't do anything (you can also use the Sounds preferences
later on to disable or remove the sounds if you get tired of them).<BR>
<IMG SRC="pictures/StartingSoundPreferences.png" WIDTH="291" HEIGHT="445"
ALT="[Starting Sound Preferences]"> <IMG
SRC="pictures/SoundPrefChoosingAFile.png" WIDTH="318" HEIGHT="387"
ALT="[Sound Preferences Choosing a File]">
<P>When you're done, it should look something like this:<BR>
<IMG SRC="pictures/SoundPrefFinished.png" WIDTH="314" HEIGHT="245"
ALT="[Sound Preferences Finished]">
<LI>Add some example messages to the database.
<OL TYPE="A">
<LI>If you don't want to do this, see step B. You need to add roughly the
same number of sample Spam messages as you add of genuine e-mail. A few
hundred of each should do, though you can get useful results with a dozen.
<P>Run the AGMSBayesianSpamServer program again. This time it shouldn't
complain. Click the "Create" button to make a new database with the
default name of "<A
HREF="file:/boot/home/config/settings/AGMSBayesianSpam/AGMSBayesianSpam%20Database"
>/boot/home/config/settings/AGMSBayesianSpam/AGMSBayesianSpam Database</A>".
<P>Use the "Add Example of Spam/Genuine" button, and only select at most
80 files at a time (otherwise the Tracker/File Requester will lock up and
you'll have to reboot your computer). It will ask you to identify each
file as spam or genuine, you also have the choice of identifying a whole
batch of them as all spam or all genuine.<BR>
<IMG SRC="pictures/SingleMessageClassificationRequest.png"
ALT="[Single Message Classification Request]"
WIDTH="349" HEIGHT="104" ALIGN="LEFT">
<IMG SRC="pictures/MultipleMessageClassificationRequest.png"
ALT="[Multiple Message Classification Request]"
WIDTH="349" HEIGHT="104" ALIGN="RIGHT">
<BR CLEAR="ALL">
<P>You can also drag and drop example messages into the bottom half of
the window. Drop in the left side for genuine, right side for spam, but
avoid the middle third of the window.<BR>
<IMG SRC="pictures/DropZones.png" ALT="[Drop Zones]"
WIDTH="596" HEIGHT="204"><BR>
<P>If you have thousands of messages, use the command line mode.<BR>
<IMG SRC="pictures/CommandLineSetSpam.png" ALT="[Command Line Set Spam]"
WIDTH="634" HEIGHT="205">
<LI>If you don't have a few hundred spam messages, instead of doing step
A copy the sample database file to "AGMSBayesianSpam Database" in the <A
HREF="file:/boot/home/config/settings/AGMSBayesianSpam/"
>/boot/home/config/settings/AGMSBayesianSpam/</A> directory (the MDR
installer will do this for you). Due to complaints about the huge file
size, the sample spam database that comes with MDR is now very small
(10 spam, 10 genuine example messages), so you'll need to train it before
it gets accurate (auto-training is your friend). Or you could get the
huge (976KB, 484 spam, 1009 genuine messages) one from version 2.0.0 Beta
8, available at: <A
HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/bemaildaemon/AGMSBayesianSpamServer/SampleDatabase?rev=release-2-0-0-beta8"
>http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/bemaildaemon/AGMSBayesianSpamServer/SampleDatabase?rev=release-2-0-0-beta8</A>
<BR>
<IMG SRC="pictures/DatabaseFileLocation.png"
ALT="[Database File Location]" WIDTH="609" HEIGHT="234"><BR>
Run the AGMSBayesianSpamServer program again. Hit the Purge button
(because it doesn't load the database until it has to do something). If
things are working correctly, you should see a list of the words in the
sample database in the bottom half of the window. An alternative method
of picking a database file is to double click on it in Tracker, which is
useful if you don't want to type in the full name.
</OL>
<LI>Quit the AGMSBayesianSpamServer program. Delete all the remaining
files you unzipped from the archive (such as the example database, this
readme, this documentation, or source code), unless you want to
keep them around. You will have to decide where to store them; I can't
tell you everything :-).
<LI>Start up the E-mail preferences control panel (part of the Mail Daemon
Replacement project).<BR>
<IMG SRC="pictures/StartingEMailPreferences.png"
ALT="[Starting EMail Preferences]" WIDTH="291" HEIGHT="443"><BR>
Choose the e-mail account you wish to have checked for spam. Then hit the
Add Filter button to bring up the menu with the list of filters you can
add, and pick AGMSBayesianSpamFilter.<BR>
<IMG SRC="pictures/ClickingOnAddFilterShowsList.png"
ALT="[Clicking On Add Filter Shows List]" WIDTH="454" HEIGHT="413"><BR>
Remember to click on the filter after you have added it to set the settings
(though the defaults are useable too).<BR>
<IMG SRC="pictures/ClickOnFilterNameToGetSettings.png"
ALT="[Click On Filter Name To Get Settings]" WIDTH="454" HEIGHT="413"><BR>
Then select the settings you wish. If you installed sound files earlier,
you can turn on the sound effects here.<BR>
<IMG SRC="pictures/FilterSettings.png" ALT="[Filter Settings]"
WIDTH="454" HEIGHT="413">
<LI>Test it. Send yourself some e-mail and see if it gets rated correctly.
</OL>
<H1><A NAME="Usage"></A>Usage</H1>
<H2><A NAME="Reading"></A>Reading E-Mail</H2>
<P>Check for e-mail as usual. If you look at the inbox directory in Tracker,
you can add an extra column with the E-mail attribute "Spam/Genuine Estimate"
to see how spammy the messages are. 0.0 means the system thinks the message is
fully genuine, 1.0 fully spam. But it can be wrong, for things like a friend
of yours quoting a spam message. For the Chi-squared method (the default), you
see numbers close to zero for genuine (like 9.750e-13), close to 1 for spam and
in-between (0.01 to 0.99) if it can't decide. With the Robinson scoring
method, usually if it is over 0.56 (the best cutoff value depends a bit on your
database quality, but 0.56 is typical) then it is spam, and the closer it is to
1.0 the more likely it really is spam.
<P>I sort by spam ratio, and manually throw away the messages that are spammy,
then I switch the Tracker window back to sorting by thread+date (just a click
on the appropriate column title does it) and get on with reading the mail.
<P>If you turned on the filter option to modify the subject, you'll see spam
messages with something like [Spam 95%] in front of the subject (I don't use it
because it looks ugly). But only in the Tracker display of the Subject, the
actual subject inside the message isn't affected, just the MAIL:subject
attribute, which is what the Tracker shows.
<H2><A NAME="Training"></A>Training</H2>
<P><EM>The accuracy is only as good as your database</EM>, so update it with
more example spam and genuine messages. In particular, if it gets the estimate
wrong, add that message to the database to tell it what it should be doing. A
quick way to do that is to right click on the e-mail in Tracker, and pick Open
With... AGMSBayesianSpamServer.<BR>
<IMG SRC="pictures/SortingInboxBySpamEstimate.png"
ALT="[Sorting Inbox By Spam Estimate]" WIDTH="831" HEIGHT="361"><BR>
It should start up and ask you if the message is spam or genuine.<BR>
<IMG SRC="pictures/SingleMessageClassificationRequest.png"
ALT="[Single Message Classification Request]" WIDTH="349" HEIGHT="104"><BR>
You can also drag and drop the message into the left third of the word list for
genuine messages, or right third for spam messages. Dropping in the middle
third does something else that's mostly harmless and fun.<BR>
<IMG SRC="pictures/DropZones.png" ALT="[Drop Zones]" WIDTH="596"
HEIGHT="204"><BR>
<P>You may also want to train it with all your messages (it gives slightly
better results in the long run than just training on the mistakes). To make it
easier, turn on the self-training option in the mail filter. It will compute
the spam ratio of new mail messages, then feed back the same message into the
database as an example of spam/genuine. When it gets it wrong, you should
manually retrain it with the correct classification, otherwise the database
will get worse and worse and finally turn into mush.
<H2><A NAME="HidingServer"></A>Hiding the Server Window</H2>
<P>If you're annoyed by the server window popping up whenver the system checks
for e-mail, you can tell it to hide. Just click the "Server Mode" checkbox.
Actually, that's now the default since people were complaining about the window
getting in the way. The disadvantage is that you don't get to see error
messages. To make it visible again, start up AGMSBayesianSpamServer (possibly
by double clicking on its icon in <A
HREF="file:/boot/home/config/bin/">/boot/home/config/bin/</A> and bring up the
hidden window by using the deskbar, or by using the "Edit Server Settings"
button in the spam filter configuration).<BR>
<IMG SRC="pictures/MakingTheWindowVisibleFromTheDeskbar.png"
ALT="MakingTheWindowVisibleFromTheDeskbar" WIDTH="640" HEIGHT="109"><BR>
<H2><A NAME="AlexSettings"></A>Alex's Settings</H2>
<P>I'm currently using it with these settings: Chi-squared scoring,
AnyTextAndHeader tokenizing, server mode on, ignore previous classification
off, mark subject with [Spam %] off, spam cutoff 0.95, genuine below 0.05, no
words found on, self-training on, close AGMSBayesianSpamServer when Finished
on. Because of the self training, I always correct it when it gets the
classification wrong (that means I have to manually delete the messages, can't
use a Match Header filter to do it). My Tracker window shows the
Classification Group attribute rather than the Spam/Genuine Estimate number
(which isn't pretty when using Chi-squared).
<H1><A NAME="AdvancedUsage"></A>Advanced Usage</H1>
<H2><A NAME="CommandLine"></A>Command Line Mode and Scripting</H2>
<P>Besides the graphical user interface, there
is also a command line mode. Just type "AGMSBayesianSpamServer help"
in the terminal to get a list of the commands and what they do (the ultimate
documentation). It also explains all of the mysterious options you see in the
graphical user interface. The same commands can be used in scripting, either
from some other program or via the "hey" utility which you can get from <A
HREF="http://www.bebits.com/app/2042">http://www.bebits.com/app/2042</A>. A
useful command, if you have a lot of spam messages to add, is
"AGMSBayesianSpamServer set genuine *" which will use all messages in the
current directory as examples of genuine text.
<PRE>
Sat Feb 8 16:30:51 274 /tmp>AGMSBayesianSpamServer help
AGMSBayesianSpamServer - A Spam Database Server
Copyright &copy; 2002 by Alexander G. M. Smith. Released to the public domain.
Compiled on Feb 8 2003 at 11:13:28. $Revision: 1.11 $ $Header:
/cvsroot/bemaildaemon/AGMSBayesianSpamServer/AGMSBayesianSpamServer.cpp,v 1.77
2003/01/22 03:19:48 agmsmith Exp $
This is a program for classifying e-mail messages as spam (junk mail which
you don't want to read) and regular genuine messages. It can learn what's
spam and what's genuine. You just give it a bunch of spam messages and a
bunch of non-spam ones. It uses them to make a list of the words from the
messages with the probability that each word is from a spam message or from
a genuine message. Later on, it can use those probabilities to classify
new messages as spam or not spam. If the classifier stops working well
(because the spammers have changed their writing style and vocabulary, or
your regular correspondants are writing like spammers), you can use this
program to update the list of words to identify the new messages
correctly.
The original idea was from Paul Graham's algorithm, which has an excellent
writeup at: http://www.paulgraham.com/spam.html
Gary Robinson came up with the improved algorithm, which you can read about at:
http://radio.weblogs.com/0101454/stories/2002/09/16/spamDetection.html
Then he, Tim Peters and the SpamBayes mailing list developed the Chi-Squared
test, see http://mail.python.org/pipermail/spambayes/2002-October/001036.html
for one of the earlier messages leading from the central limit theorem to
the current chi-squared scoring method.
Thanks go to Isaac Yonemoto for providing a better icon.
Usage: Specify the operation as the first argument followed by more
information as appropriate. The program's configuration will affect the
actual operation (things like the name of the database file to use, or
whether it should allow non-email messages to be added). In command line
mode it will do the operation and exit. In GUI/server mode a command line
invocation will just send the command to the running server. You can also
use BeOS scripting (see the "Hey" command which you can get from
http://www.bebits.com/app/2042 ) to control the Spam server. And finally,
there's also a GUI interface which shows up if you start it without any
command line arguments.
Commands:
Quit
Stop the program. Useful if it's running as a server.
Get DatabaseFile
Get the pathname of the current database file. The default name is something
like B_USER_SETTINGS_DIRECTORY / AGMSBayesianSpam / AGMSBayesianSpamServer
Database
Set DatabaseFile NewValue
Change the pathname of the database file to use. It will automatically be
converted to an absolute path name, so make sure the parent directories exist
before setting it. If it doesn't exist, you'll have to use the create command
next.
Create DatabaseFile
Creates a new empty database, will replace the existing database file too.
Delete DatabaseFile
Deletes the database file and all backup copies of that file too. Really only
of use for uninstallers.
Count DatabaseFile
Returns the number of words in the database.
Set Spam NewValue
Adds the spam in the given file (specify full pathname to be safe) to the
database. The words in the files will be added to the list of words in the
database that identify spam messages. The files processed will also have the
attribute MAIL:classification added with a value of "Spam" or "Genuine" as
specified. They also have their spam ratio attribute updated, as if you had
also used the Evaluate command on them. If they already have the
MAIL:classification attribute and it matches the new classification then they
won't get processed (and if it is different, they will get removed from the
statistics for the old class and added to the statistics for the new one).
You can turn off that behaviour with the IgnorePreviousClassification
property. The command line version lets you specify more than one pathname.
Count Spam
Returns the number of spam messages in the database.
Set SpamString NewValue
Adds the spam in the given string (assumed to be the text of a whole e-mail
message, not just a file name) to the database.
Set Genuine NewValue
Similar to adding spam except that the message file is added to the genuine
statistics.
Count Genuine
Returns the number of genuine messages in the database.
Set GenuineString NewValue
Adds the genuine message in the given string (assumed to be the text of a
whole e-mail message, not just a file name) to the database.
Set IgnorePreviousClassification NewValue
If set to true then the previous classification (which was saved as an
attribute of the e-mail message file) will be ignored, so that you can add the
message to the database again. If set to false (the normal case), the
attribute will be examined, and if the message has already been classified as
what you claim it is, nothing will be done. If it was misclassified, then the
message will be removed from the statistics for the old class and added to the
stats for the new classification you have requested.
Get IgnorePreviousClassification
Find out the current setting of the flag for ignoring the previously recorded
classification.
Set ServerMode NewValue
If set to true then error messages get printed to the standard error stream
rather than showing up in an alert box. It also starts up with the window
minimized.
Get ServerMode
Find out the setting of the server mode flag.
Flush
Writes out the database file to disk, if it has been updated in memory but
hasn't been saved to disk. It will automatically get written when the program
exits, so this command is mostly useful for server mode.
Set PurgeAge NewValue
Sets the old age limit. Words which haven't been updated since this many
message additions to the database may be deleted when you do a purge. A good
value is 1000, meaning that if a word hasn't appeared in the last 1000
spam/genuine messages, it will be forgotten. Zero will purge all words, 1
will purge words not in the last message added to the database, 2 will purge
words not in the last two messages added, and so on. This is mostly useful
for removing those one time words which are often hunks of binary garbage, not
real words. This acts in combination with the popularity limit; both
conditions have to be valid before the word gets deleted.
Get PurgeAge
Gets the old age limit.
Set PurgePopularity NewValue
Sets the popularity limit. Words which aren't this popular may be deleted
when you do a purge. A good value is 5, which means that the word is safe
from purging if it has been seen in 6 or more e-mail messages. If it's only
in 5 or less, then it may get purged. The extreme is zero, where only words
that haven't been seen in any message are deleted (usually means no words).
This acts in combination with the old age limit; both conditions have to be
valid before the word gets deleted.
Get PurgePopularity
Gets the purge popularity limit.
Purge
Purges the old obsolete words from the database, if they are old enough
according to the age limit and also unpopular enough according to the
popularity limit.
Get Oldest
Gets the age of the oldest message in the database. It's relative to the
beginning of time, so you need to do (total messages - age - 1) to see how
many messages ago it was added.
Set Evaluate NewValue
Evaluates a given file (by path name) to see if it is spam or not. Returns
the ratio of spam probability vs genuine probability, 0.0 meaning completely
genuine, 1.0 for completely spam. Normally you should safely be able to
consider it as spam if it is over 0.56 for the Robinson scoring method. For
the ChiSquared method, the numbers are near 0 for genuine, near 1 for spam,
and anywhere in the middle means it can't decide. The program attaches a
MAIL:ratio_spam attribute with the ratio as its float32 value to the file.
Also returns the top few interesting words in "words" and the associated
per-word probability ratios in "ratios".
Set EvaluateString NewValue
Like Evaluate, but rather than a file name, the string argument contains the
entire text of the message to be evaluated.
ResetToDefaults
Resets all the configuration options to the default values, including the
database name.
InstallThings
Creates indices for the MAIL:classification and MAIL:ratio_spam attributes on
all volumes which support BeOS queries, identifies them to the system as
e-mail related attributes (modifies the text/x-email MIME type), and sets up
the new MIME type (text/x-vnd.agmsmith.spam_probability_database) for the
database file. Also registers names for the sound effects used by the
separate filter program (use the installsound BeOS program or the Sounds
preferences program to associate sound files with the names).
Set TokenizeMode NewValue
Sets the method used for breaking up the message into words. Use "Whole" for
the whole file (also use it for non-email files). The file isn't broken into
parts; the whole thing is converted into words, headers and attachments are
just more raw data. Well, not quite raw data since it converts
quoted-printable codes (equals sign followed by hex digits or end of line) to
the equivalent single characters. "PlainText" breaks the file into MIME
components and only looks at the ones which are of MIME type text/plain.
"AnyText" will look for words in all text/* things, including text/html
attachments. "AllParts" will decode all message components and look for words
in them, including binary attachments. "JustHeader" will only look for words
in the message header. "AllPartsAndHeader", "PlainTextAndHeader" and
"AnyTextAndHeader" will also include the words from the message headers.
Get TokenizeMode
Gets the method used for breaking up the message into words.
Set ScoringMode NewValue
Sets the method used for combining the probabilities of individual words into
an overall score. "Robinson" mode will use Gary Robinson's nth root of the
product method. It gives a nice range of values between 0 and 1 so you can
see shades of spaminess. The cutoff point between spam and genuine varies
depending on your database of words (0.56 was one point in some experiments).
"ChiSquared" mode will use chi-squared statistics to evaluate the difference
in probabilities that the lists of word ratios are random. The result is very
close to 0 for genuine and very close to 1 for spam, and near the middle if it
is uncertain.
Get ScoringMode
Gets the method used for combining the individual word ratios into an overall
score.
ProcessArgs: The property specified isn't known or doesn't support the requested action (usually means it is an unknown command), error code $FFFFFFFF/-1 (General OS error) has occured.
AGMSBayesianSpamServer shutting down...
Sat Feb 8 16:30:58 275 /tmp>
</PRE>
<!-- End the C style comment which makes editing this look bad with BeIDE's syntax colouring. */ -->
<H2><A NAME="Spreadsheet"></A>Using a Spreadsheet to Examine Word Statistics</H2>
<P>Another advanced trick is to load the list of words into Gobe Productive's
spreadsheet, so that you can find the most popular word or chart the word
frequencies. Unfortunately it can only handle about 16000 words. To do that,
start up Gobe Productive, pick Open, then from the file requester's "Document
Type" menu, pick "Spreadsheet" and then in the submenu pick "Tab-delimited
text". Then navigate to the database, the default location is "<A
HREF="file:/boot/home/config/settings/AGMSBayesianSpam/AGMSBayesianSpam%20Database"
>/boot/home/config/settings/AGMSBayesianSpam/AGMSBayesianSpam Database</A>".
Have fun!
<H2><A NAME="WordDisplay"></A>Understanding and Using the Word Display</H2>
<P><IMG ALIGN="RIGHT" SRC="pictures/WordDisplay.png" WIDTH="285" HEIGHT="645"
ALT="[Narrow Word Display Window]">The word display tells you more than you
need to know about the words in the database. Those colour bars actually mean
something.
<P>Obviously words which are more genuine than spamish show up in <FONT
COLOR="BLUE">blue</FONT>, while spammier words are in <FONT
COLOR="RED">red</FONT>. It's proportionally based on the total message counts
so that a word which shows up in 10% of the genuine messages and 9% of the spam
will show up in blue, even if it was in more spam messages than genuine
messages (this compensates a bit for not training on an equal number of spam
and genuine messages). The length of the bar shows the ratio of the
proportions; further to the left for larger genuine proportions, and similarly
further right for larger spam proportions.
<P>The thickness of the bar shows how many messages the word was found in.
It's kind of a weight, saying how frequently used that word is and thus how
significant it is.
<P>The paleness of the bar shows you how old that word is. A light colour
means that the word was last added to the database long ago. A darker, more
saturated colour means that the word was added more recently, when you added
example messages to the database.
<P>Finally, if you click on the word display, the background will change from a
pale blue tint into solid white, to show you that it is the active keyboard
focus. That means you can type in letters to find a particular word (delay for
one second to start typing the letters for a new word). The arrow keys, page
up/down keys and the mouse scroll wheel also show you different words. Sorry,
there's no scroll bar since finding the Nth word is a slow operation with a set
of words (they aren't numbered); each twitch of the scroll bar would mean going
through the list of tens or even hundreds of thousands of words and counting to
find the scroll position.
<BR CLEAR="ALL">
<H2><A NAME="Tokenizing"></A>Tokenizing Modes Compared</H2>
<P>I did some tests with tokenizing different parts of mail messages to see
what would work best.
<P>The Database:
<BR>341 training genuine messages, 406 training spam messages (or 398 when
parsing due to a bug (fixed later on in 2.0.0b5) with messages that don't have
body text).
<BR>40 test genuine messages, 40 test spam messages, all more recent than the
training ones.
<BR>Spam threshold is 0.56, Gary-combining method.
<P>The results:
<TABLE BORDER="2" SUMMARY="[Table showing results of different tokenizing methods]">
<TR><TH>Tokenizing Method
<TH>Genuine Test Details
<TH>Genuine Accuracy
<TH>Spam Test Details
<TH>Spam Accuracy
<TR><TD>Just headers
<TD>Genuine .181352 to .557881, one false positive (a mailbox full announcement).
<TD>2.5% wrong.
<TD>Spam .450602 to .750511, 21 false negatives.
<TD>52.5% wrong.
<TR><TD>Whole raw message text
<TD>Genuine .163027 to .627022, 3 false positives.
<TD>7.5% wrong.
<TD>Spam .509355 to .993985, 1 false negative.
<TD>2.5% wrong.
<TR><TD>Message parsed into parts plus header
<TD>Genuine .168857 to .609005, 4 false positives.
<TD>10% wrong.
<TD>Spam .614564 to .994364, 0 false negatives.
<TD>0% wrong.
<TR><TD>Message parsed into parts, no header data
<TD>Genuine .220161 to .631161, 5 false positives.
<TD>12.5% wrong.
<TD>Spam .592501 to .994444, 0 false negatives.
<TD>0% wrong.
<TR><TD>Any text parts and header
<TD>Genuine .162697 to .614136, 4 false positives.
<TD>10% wrong.
<TD>Spam .614973 to .994362, 0 false negatives.
<TD>0% wrong.
<TR><TD>Any text parts, no headers
<TD>Genuine .221923 to .635487, 6 false positives.
<TD>15% wrong.
<TD>Spam .594271 to .994441, 0 false negatives.
<TD>0% wrong.
<TR><TD>text/plain parts (including body text)
<TD>Genuine .137869 to .583192, 3 false positives.
<TD>7.5% wrong.
<TD>Spam .448059 to .994119, 17 false negatives.
<TD>42.5% wrong.
<TR><TD>Only text/plain sub-parts, no headers.<BR>
150 spam and 1 genuine training message had no words!
<TD>Genuine .219169 to .696899, 9 false positives.
<TD>22.5% wrong.
<TD>Spam .660755 to .994116, 0 false negatives, 27 had no words.
<TD>0% wrong.
</TABLE>
<P>The results look good for the whole message tokenizing method (which also
works on non-email files) and for the all text parts plus header. Since the
text parts method doesn't add lots of garbage words to the database from trying
to find words in binary attachments, it's now the default setting.
<P>The header only method is pretty good too for identifying genuine messages,
and so-so for spam messages. That may make it useable for pre-download tests
(delete some of the spam on the mail server before downloading it, without
worrying about deleting too many genuine messages).
<H2><A NAME="HeadersOnly"></A>High Speed and High Danger - Headers Only Trick</H2>
<P>If you have a slow dial-up connection, you may wish to classify your mail
quickly by deleting spam messages without downloading the entire junk message.
<P><IMG SRC="pictures/ChoosingJustHeaderTokenizingMode.png" WIDTH="920"
HEIGHT="402" ALT="[Choosing JustHeader Tokenizing Mode]">
<P><IMG SRC="pictures/DangerousMatchFilter.png" WIDTH="276" HEIGHT="243"
ALIGN="RIGHT" ALT="[Dangerous Match Filter]">This can be done with three
settings. First switch the AGMSBayesianSpamServer into tokenizing just the
headers. Then go into the E-mail preferences and add an
AGMSBayeisianSpamFilter with the "Add [Spam %] in Front of Subject" option
turned on, and the ratio set to a nice safe high level like 0.95 (so that your
genuine mail is less likely to get deleted, but it will still delete the 1% of
your real mail that looks like spam, which is why this is dangerous). Do not
turn on self-training, since you can't manually correct it. Finally in the
E-mail preferences, add a "Match Header" filter after the spam filter and set
it so that If <B>Subject</B> is <B>\[Spam*</B> then <B>Delete Message</B>.
That's backslash, left square bracket, Spam with the S capitalised, asterix.
Now it will download the headers, check them against the spam database, and
then delete the spam ones on the server without downloading the rest of their
contents.
<P>You should also make a new spam database trained in Just Headers tokenizing
mode with roughly equal examples of your genuine messages and spam messages (50
of each should be enough to start). A full message database may also work, but
headers only training should be more accurate for headers only decisions. When
testing JustHeader mode, I noticed that the false positive rate (genuine
reported as spam) is nice and low, but the false negative rate (spam reported
as genuine) is high (tested with Robinson scoring, not Chi-Squared scoring).
So this means JustHeader mode will delete maybe half the spam (and download the
rest) and also delete the occasional genuine message.
<H1><A NAME="ChangeLog"></A>Change Log</H1>
<P>The various versions released to the public. These are actually several
accumulated minor changes, which you can see by looking at the log in the top of the
source code files.
<UL>
<LI>Version 1.77 changed the tokenizing to not convert words to lower case,
the case is important for spam! Minimize the window before opening it so
that it doesn't flash on the screen in server mode. Also load the database
when the window is displayed so that the user can see the words.
<LI>Version 1.73 added self training support and the Chi-Squared scoring
method.
<LI>Version 1.68 nothing significant changed. Just very minor tweaking.
<LI>Version 1.65 added a time delay for exiting the program. This is so that
multiple e-mail accounts can simultaneously download mail, without having the
server close when one of the accounts finishes downloading. Scripting
requests that come in while it is counting down to quitting time will cancel
the countdown. In the belt <I>and</I> suspenders department, the filter has
been enhanced to try starting up the server up to three times.
<LI>Version 1.60 got rid of the need to use a modified Inbox filter for MDR
(found out the correct way of setting attributes on a message), added sound
effects, and added parsing of mail messages (parsing MIME headers, decoding
base64, quoted-printable and converting character sets to UTF-8 for text, all
thanks to using the MDR mail kit, which you now need since it uses their
libmail.so code library). There are now new options for selecting what kind
of parsing to do (text/plain or text/* or */* attachments, with or without
headers, etc). Plus sound effect options. The sample database has also been
updated to use text/* plus headers tokenization, which makes it slightly
smaller.<!-- End the C style comment which makes editing this look bad with
BeIDE's syntax colouring. */ -->
<LI>Version 1.49 switched to Gary Robinson's method for calculating spam
ratios. The overall results are about the same but you have less false
positives and the numbers are spread more evenly between 0.0 and 1.0 than
with Paul Graham's method (change the E-mail preferences filter setting
cutoff point to 0.56, adjust as needed). Also, as "jaf" requested, you can
now drag and drop messages into the word list - drop in the left third to use
it as an example of genuine messages, right third for spam, and middle third
to get an evaluation of a message's spaminess. Also a useless command was
removed. Updated files (replace your existing copies): AGMSBayesianSpam
Database, AGMSBayesianSpamFilter, AGMSBayesianSpamServer.
<LI>Version 1.47 was the first public (and working) version. It used Paul
Graham's algorithm with a few simplifications.
</UL>
<P>Released to the public domain in 2002 by the author, Alexander G. M. Smith.
</BODY>
</HTML>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB