haiku-website/static/legacy-docs/bebook/TheMailDaemon_Overview.html

96 lines
15 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - System Overview - The Mail Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheMailKit_Overview.html" title="The Mail Kit" /><link rel="prev" href="TheMailKit_Overview_Introduction.html" title="Introduction" /><link rel="next" href="BMailMessage_Overview.html" title="BMailMessage" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="TheMailKit_Overview_Introduction.html" title="Introduction"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheMailKit_Overview.html" title="The Mail Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BMailMessage_Overview.html" title="BMailMessage"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - System Overview - The Mail Kit</div></div><div id="headerB">Prev: <a href="TheMailKit_Overview_Introduction.html">Introduction</a>  Up: <a href="TheMailKit_Overview.html">The Mail Kit</a>  Next: <a href="BMailMessage_Overview.html">BMailMessage</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="TheMailDaemon_Overview"></a>The Mail Daemon</h2></div></div></div><p>Every computer running the BeOS has a mail daemon; this is a local
process that's responsible for sending e-mail to and receiving e-mail from
a mail server. The mail server that the daemon talks to is a networking
application that's either part of your Internet Service Provider's
services, or that's running on a local "mail repository" machine.</p><p>The functions described in this section tell you how to manage the mail
daemon's connection with the mail server—how to tell the daemon which mail
server to communicate with, how to tell the mail daemon to send and
retrieve e-mail, how to automate mail retrieval, and so forth.</p><p>Many of the functions described here are user-accessible through the
E-mail preference application. These functions should generally not be
used; the settings they control belong to the user, and your application
should usually avoid changing the user's settings. The only legitimate
reason to use these configuration setting functions is if you want to build
your own E-mail preference application.</p><p>The other functions, such as
<a class="link" href="TheMailDaemon_Functions.html#forward_mail" title="forward_mail()"><code class="function">forward_mail()</code></a>,
<a class="link" href="TheMailDaemon_Functions.html#check_for_mail" title="check_for_mail()"><code class="function">check_for_mail()</code></a>,
<a class="link" href="TheMailDaemon_Functions.html#encode_base64" title="encode_base64()"><code class="function">encode_base64()</code></a>,
and <a class="link" href="TheMailDaemon_Functions.html#decode_base64" title="decode_base64()"><code class="function">decode_base64()</code></a>,
might be legitimately used by your e-mail program.</p><p>The architecture of an e-mail message isn't discussed here; for that
information, see
<a class="link" href="BMailMessage.html" title="BMailMessage"><code class="classname">BMailMessage</code></a>.</p><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="TheMailDaemon_AndTheMailServer"></a>The Mail Daemon and the Mail Server</h3></div></div></div><p>The mail daemon can talk to two different kinds of mail server:</p><div class="orderedlist"><ol><li><p>The Post Office Protocol (<acronym class="acronym">POP</acronym>) server manages individual mail
accounts. When the BeOS mail daemon wants to retrieve mail that's been sent
to a user, it must tell the mail server which <acronym class="acronym">POP</acronym> accouant it's retrieving
mail for.</p></li><li><p>The Simple Mail Transfer Protocol (<acronym class="acronym">SMTP</acronym>) server manages mail
that's being sent out onto the network. Messages sent through an <acronym class="acronym">SMTP</acronym>
server will eventually find their way to a <acronym class="acronym">POP</acronym> server to be received by the
destination user.</p></li></ol></div><p>The <acronym class="acronym">POP</acronym> and the <acronym class="acronym">SMTP</acronym> servers are identified by their hosts' names (in
other words, the names of the machines on which the servers are running).
The mail daemon can only talk to one POP and one <acronym class="acronym">SMTP</acronym> server at a time, but
can talk to the two of them simultaneously. Usually—but not always—the
<acronym class="acronym">POP</acronym>
and <acronym class="acronym">SMTP</acronym> servers reside on the same machine, and so are identified by the
same name.</p><p>To set the identities of the <acronym class="acronym">POP</acronym> host, you fill in the fields of a
<span class="type">mail_pop_account</span> structure and pass the structure to the
<a class="link" href="TheMailDaemon_Functions.html#set_pop_account"><code class="function">set_pop_account()</code></a>
function. As the name of the structure implies, <span class="type">mail_pop_account</span> encodes
more than just the names of the server's host. It also identifies a
specific user's <acronym class="acronym">POP</acronym> mail account; the complete definition of the structure
is this:</p><pre class="programlisting example c">typedef struct {
<span class="type">char</span> <code class="varname">pop_name</code>[<code class="constant">B_MAX_USER_NAME_LENGTH</code>];
<span class="type">char</span> <code class="varname">pop_password</code>[<code class="constant">B_MAX_USER_NAME_LENGTH</code>];
<span class="type">char</span> <code class="varname">pop_host</code>[<code class="constant">B_MAX_HOST_NAME_LENGTH</code>];
<span class="type">char</span> <code class="varname">real_name</code>[128];
<span class="type">char</span> <code class="varname">reply_to</code>[128];
<span class="type">int32</span> <code class="varname">days</code>;
<span class="type">int32</span> <code class="varname">interval</code>;
<span class="type">int32</span> <code class="varname">begin_time</code>;
<span class="type">int32</span> <code class="varname">end_time</code>;
} <span class="type">mail_pop_account</span>;</pre><p>The <code class="varname">pop_name</code>, <code class="varname">pop_password</code>,
and <code class="varname">pop_host</code> fields in the <span class="type">mail_pop_account</span>
structure represent the username, password, and <acronym class="acronym">POP</acronym> server host of the
e-mail user. The <code class="varname">real_name</code> is the user's real name, and <code class="varname">reply_to</code> is the
e-mail address to which replies should be sent.</p><p>The <code class="varname">days</code> field can contain any of the following flags to specify which
days of the week the mail daemon should automatically check mail for the
described account:</p><table class="variablelist constants"><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_CHECK_NEVER</code></span></p></td><td><p>Don't automatically check the account's mail.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_CHECK_WEEKDAYS</code></span></p></td><td><p>Check the mail only on weekdays.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_CHECK_DAILY</code></span></p></td><td><p>Check the mail every day.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_CHECK_CONTINUOUSLY</code></span></p></td><td><p>Check continuously every day.</p></td></tr></tbody></table><p>The <code class="varname">interval</code> specifies how many seconds apart each e-mail retrieval
should be, and the <code class="varname">begin_time</code> and
<code class="varname">end_time</code> specify the time of day (in
seconds) that automatic retrieval should begin and end.</p><p>The <acronym class="acronym">SMTP</acronym> server can be selected by calling
<a class="link" href="TheMailDaemon_Functions.html#set_smtp_host"><code class="function">set_smtp_host()</code></a>, passing in
a pointer to the <acronym class="acronym">SMTP</acronym> host's name.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="TheMailDaemon_SendingAndRetrievingMail"></a>Sending and Retrieving Mail</h3></div></div></div><p>Messages that are retrieved (from the mail server) by the mail daemon
are stored as individual files on the user's hard disk, from whence they
are plucked and displayed by a mail-reading application (a "mail reader";
Be supplies a simple mail reader called <span class="application">BeMail</span>). Similarly, messages that
the user composes (in a mail composition application) and sends are stored
as individual files until the mail daemon comes along and passes them on to
the mail server.</p><p>Sending and retrieving mail is the mail daemon's most important
function. Both actions (server-to-database and database-to-server
transmission) are performed through the
<a class="link" href="TheMailDaemon_Functions.html#check_for_mail" title="check_for_mail()"><code class="function">check_for_mail()</code></a>
function.</p><p>The <a class="link" href="BMailMessage.html" title="BMailMessage"><code class="classname">BMailMessage</code></a>
class provides a convenient means for creating and
sending new mail messages; visit the section on that class for further
information and a simple example.</p><p>Mail that has been retrieved by the mail daemon can be identified and
queried using the mail attributes defined by the Mail Kit. By using the
<a class="link" href="BQuery.html" title="BQuery"><code class="classname">BQuery</code></a>
class, you can scan all newly-received mail messages and parse the
message file to present each message to the user. For a more in-depth
discussion of the mail attributes and how to use them to your benefit, read
"<a class="xref" href="TheMailKit_Overview_Introduction.html#TheMailKit_QueryingMailMessages" title="Querying Mail Messages">Querying Mail Messages</a>."</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="TheMaildaemon_OtherFeatures"></a>Other Mail Daemon Features</h3></div></div></div><p>The other mail structures and functions define the other features that
are provided by the mail daemon. These features are:</p><dl class="variablelist"><dt><span class="term">Mail notification.</span></dt><dd><p>The <span class="type">mail_notification</span> structure (passed through the
<a class="link" href="TheMailDaemon_Functions.html#set_mail_notification"><code class="function">set_mail_notification()</code></a>
function) lets you tell the daemon how
you would like it to tap you on the shoulder when it has new mail for you
to read. Would you like it to display an alert panel? Squawk at you? Both?
This can be configured by the user in the E-mail preference application.</p></dd><dt><span class="term">Mail forwarding.</span></dt><dd><p>The
<a class="link" href="TheMailDaemon_Functions.html#forward_mail" title="forward_mail()"><code class="function">forward_mail()</code></a>
function lets you ask the Mail Kit to forward a message to one or more other accounts.</p></dd><dt><span class="term">Base-64 encoding and decoding.</span></dt><dd><p>The
<a class="link" href="TheMailDaemon_Functions.html#encode_base64" title="encode_base64()"><code class="function">encode_base64()</code></a> and
<a class="link" href="TheMailDaemon_Functions.html#decode_base64" title="decode_base64()"><code class="function">decode_base64()</code></a>
functions let you easily handle ASCII-encoded file attachments.</p></dd></dl></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="TheMailKit_Overview_Introduction.html">Introduction</a>  Up: <a href="TheMailKit_Overview.html">The Mail Kit</a>  Next: <a href="BMailMessage_Overview.html">BMailMessage</a> </div><div id="footerB"><div id="footerBL"><a href="TheMailKit_Overview_Introduction.html" title="Introduction"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheMailKit_Overview.html" title="The Mail Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BMailMessage_Overview.html" title="BMailMessage"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>