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

55 lines
17 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.

This file contains Unicode characters that might be confused with other characters. 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 - Classes And Methods - 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.html" title="The Mail Kit" /><link rel="prev" href="TheMailKit.html" title="The Mail Kit" /><link rel="next" href="TheMailDaemon_Functions.html" title="The Mail Daemon Functions" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="TheMailKit.html" title="The Mail Kit"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheMailKit.html" title="The Mail Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="TheMailDaemon_Functions.html" title="The Mail Daemon Functions"><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 - Classes And Methods - The Mail Kit</div></div><div id="headerB">Prev: <a href="TheMailKit.html">The Mail Kit</a>  Up: <a href="TheMailKit.html">The Mail Kit</a>  Next: <a href="TheMailDaemon_Functions.html">The Mail Daemon Functions</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="BMailMessage"></a>BMailMessage</h2></div></div></div><a id="id1114749" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">mail/E-mail.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libmail.so</code></td></tr><tr><td>Allocation:</td><td></td></tr></tbody></table></td><td>
<a class="link overview" href="BMailMessage_Overview.html" title="BMailMessage">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BMailMessage.html#BMailMessage_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BMailMessage.html#BMailMessage_MemberFunctions">Member Functions</a></span></li></ul></div>
</td></tr></tbody></table></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="BMailMessage_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMailMessage_Constructor"></a>BMailMessage()</h4></div></div></div><code class="constructorsynopsis cpp"><span class="methodname">BMailMessage</span>();</code><p>Creates and returns a new <code class="classname">BMailMessage</code> object, which is empty. You need
to call other functions defined by this class to fill out the message.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMailMessage_Destructor"></a>BMailMessage()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="methodname">BMailMessage</span>();</code><p>Destroys the <code class="classname">BMailMessage</code>, even if the
object's fields are "dirty." For
example, if you create a new <code class="classname">BMailMessage</code> object with the intention of
sending a message, fill out some or all of the fields, and then delete
the object, the object is destroyed without being sent.</p></div></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="BMailMessage_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMailMessage_AddContent"></a>AddContent()</h4></div></div></div><div class="synopsisgroup">
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddContent</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">text</span></span>,<br />                    <span class="methodparam"><span class="type">int32 </span><span class="parameter">length</span></span>,<br />                    <span class="methodparam"><span class="type">uint32 </span><span class="parameter">encoding</span><span class="initializer"> = <span class="constant">B_ISO1_CONVERSION</span></span></span>,<br />                    <span class="methodparam"><span class="type">bool </span><span class="parameter">replace</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code>
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddContent</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">text</span></span>,<br />                    <span class="methodparam"><span class="type">int32 </span><span class="parameter">length</span></span>,<br />                    <span class="methodparam"><span class="type">const char* </span><span class="parameter">encoding</span></span>,<br />                    <span class="methodparam"><span class="type">bool </span><span class="parameter">replace</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code>
</div><p>Adds the specified text (which contains length characters) to the
<code class="classname">BMailMessage</code> object's content. The text's encoding is specified by the
<code class="parameter">encoding</code> parameter, either directly or by pointer.</p><p>If <code class="parameter">replace</code> is <code class="constant">true</code>, any
existing text is deleted before the new content
is added; otherwise, the specified text is appended to the end of the
existing message content.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>The content was changed without error.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ERROR</code>.</span></p></td><td><p>Unable to add the new content.</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMailMessage_AddEnclosure"></a>AddEnclosure()</h4></div></div></div><div class="synopsisgroup">
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddEnclosure</span>(<span class="methodparam"><span class="type">entry_ref* </span><span class="parameter">enclosure_ref</span></span>,<br />                      <span class="methodparam"><span class="type">bool </span><span class="parameter">replace</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code>
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddEnclosure</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">path</span></span>,<br />                      <span class="methodparam"><span class="type">bool </span><span class="parameter">replace</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code>
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddEnclosure</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">mime_type</span></span>,<br />                      <span class="methodparam"><span class="type">void* </span><span class="parameter">data</span></span>,<br />                      <span class="methodparam"><span class="type">int32 </span><span class="parameter">length</span></span>,<br />                      <span class="methodparam"><span class="type">bool </span><span class="parameter">replace</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code>
</div><p>Adds an attachment to the message. The first two forms of
<code class="methodname">AddEnclosure()</code>
add a file to the message, given either an <span class="type">entry_ref</span> pointer or a
pathname. The third form adds a block of memory (of the given <code class="parameter">length</code>) to
the message as an enclosure, with the specified MIME type.</p><p>If <code class="parameter">replace</code> is <code class="constant">true</code>,
any existing attachments—including the body of
the message—are removed before the new one is added; otherwise the
new enclosure is added, leaving previous attachments intact.</p><p>If you specify <code class="constant">true</code> for <code class="parameter">replace</code>,
not only will all existing enclosures
be discarded, but so will the content of the message body itself.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>The content was changed without error.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ERROR</code>.</span></p></td><td><p>Unable to add the new enclosure.</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMailMessage_AddHeaderField"></a>AddHeaderField()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddHeaderField</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">field_name</span></span>,<br />                        <span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">field_str</span></span>,<br />                        <span class="methodparam"><span class="type">bool </span><span class="parameter">replace</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code><p>Adds a header field to the <code class="classname">BMailMessage</code> object. The value of the field
whose name is specified by <code class="parameter">field_name</code> is set to the string specified by
<code class="parameter">field_str</code>.</p><p>If <code class="parameter">replace</code> is <code class="constant">true</code>, all
existing header fields of the specified name are
deleted before adding the new header field; if <code class="parameter">replace</code>
is <code class="constant">false</code>, a new
header whose field is named <code class="constant">field_name</code> is added.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>The content was changed without error.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_ERROR</code>.</span></p></td><td><p>Unable to add the new header field.</p></td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMailMessage_Send"></a>Send()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">Send</span>(<span class="methodparam"><span class="type">bool </span><span class="parameter">send_now</span><span class="initializer"> = <span class="constant">false</span></span></span>,<br />              <span class="methodparam"><span class="type">bool </span><span class="parameter">remove_when_sent</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code><p>Queues the message for transmission. If <code class="parameter">send_now</code>
is <code class="constant">true</code>, the message is
sent immediately; otherwise, it is placed in the queue to be sent the
next time <a class="link" href="TheMailDaemon_Functions.html#check_for_mail" title="check_for_mail()"><code class="function">check_for_mail()</code></a>
is called or the mail daemon performs an
automatic mail check.</p><p>If the <code class="parameter">remove_when_sent</code> argument is
<code class="constant">true</code>, the message will be deleted
from the user's disk drive after it has been sent; otherwise, it will be
saved for posterity.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>The message was queued successfully</p></td></tr><tr><td><p><span class="term"><code class="constant">B_MAIL_NO_RECIPIENT</code>.</span></p></td><td><p>There needs to be either a "To" or "Bcc" field
in the message.</p></td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="TheMailKit.html">The Mail Kit</a>  Up: <a href="TheMailKit.html">The Mail Kit</a>  Next: <a href="TheMailDaemon_Functions.html">The Mail Daemon Functions</a> </div><div id="footerB"><div id="footerBL"><a href="TheMailKit.html" title="The Mail Kit"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheMailKit.html" title="The Mail Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="TheMailDaemon_Functions.html" title="The Mail Daemon Functions"><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>