<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"/> <title>mail::emailAddress</title> <link rel="stylesheet" href="manpage.css" type="text/css"/> <link rel="home" href="index.html" title="Cone: COnsole Newsreader And Emailer"/> <link rel="up" href="misc.html" title="Extra/Miscellaneous objects/methods"/> <link rel="prev" href="mail-attachments.html" title="mail::Attachment"/> <link rel="next" href="envelope.html" title="mail::envelope"/> <link xmlns="" rel="icon" href="icon.gif" type="image/gif"/> <meta xmlns="" name="MSSmartTagsPreventParsing" content="TRUE"/> <!-- Copyright 2002 - 2007 Double Precision, Inc. See COPYING for distribution information. --> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center" rowspan="1"> mail::emailAddress</th> </tr> <tr> <td width="20%" align="left" rowspan="1" colspan="1"> <a accesskey="p" href="mail-attachments.html" shape="rect">Prev</a> </td> <th width="60%" align="center" rowspan="1" colspan="1"> Extra/Miscellaneous objects/methods</th> <td width="20%" align="right" rowspan="1" colspan="1">  <a accesskey="n" href="envelope.html" shape="rect">Next</a></td> </tr> </table> <hr/> </div> <div class="refentry" title="mail::emailAddress"> <a id="emailaddress" shape="rect" name="emailaddress"> </a> <div class="titlepage"/> <div class="refnamediv"> <h2>Name</h2> <p>mail::emailAddress — An E-mail address</p> </div> <div class="refsynopsisdiv" title="Synopsis"> <h2>Synopsis</h2> <div class="literallayout"> <p><br clear="none"/> #include <libmail/rfcaddr.H><br clear="none"/> <br clear="none"/> mail::emailAddress address;<br clear="none"/> <br clear="none"/> address.setDisplayName("Jóse Smith");<br clear="none"/> address.setDisplayAddr("josesmith@example.com");<br clear="none"/> <br clear="none"/> std::string addr=address.getDisplayAddr();<br clear="none"/> std::string name=address.getDisplayName();<br clear="none"/> <br clear="none"/> address.setAddr(addr);<br clear="none"/> address.setDisplayName(name);<br clear="none"/> <br clear="none"/></p> </div> </div> <div class="refsect1" title="USAGE"> <a id="id605048" shape="rect" name="id605048"> </a> <h2>USAGE</h2> <p><span class="structname">mail::emailAddress</span> is a subclass of <span class="structname">mail::address</span> that defines four new methods: <code class="function">getDisplayName()</code>, <code class="function">setDisplayName()</code>, <code class="function">getDisplayAddr()</code> and <code class="function">setDisplayAddr()</code>, which retrieve or set the name and the address components of an E-mail address using the native character set. <span class="structname">mail::emailAddress</span> can be constructed from an existing <span class="structname">mail::address</span>; or, the default constructor initializes an empty address, then use <code class="function">setDisplayName()</code> and <code class="function">setDisplayAddr()</code> to set the address structure. <code class="function">setDisplayName()</code> and <code class="function">setDisplayAddr()</code> return an empty string if the display name or address was succesfully mapped from the native character, or an error message.</p> <p>Non-Latin characters in the name component use MIME encoding. Passing the name component to <code class="function">setDisplayName()</code> MIME-encodes it using RFC 2047 and stores the encoded name in the <span class="structname">mail::address</span> superclass. <code class="function">setDisplayAddr()</code> encoded non-Latin characters in the domain portion of the address using IDNA encoding. <code class="function">getDisplayName()</code> and <code class="function">getDisplayAddr()</code> retrieve the name or the address portion from the <span class="structname">mail::address</span> superclass, and decode it into the native character set, accordingly.</p> <p>For most purposes, using <span class="structname">mail::emailAddress</span> is preferrable to using <span class="structname">mail::address</span>. <span class="structname">mail::address</span>'s <code class="function">getName()</code>, <code class="function">setName()</code>, <code class="function">getAddr()</code> and <code class="function">setAddr()</code> methods deal with the raw, MIME-encoded format of E-mail addresses. This structure lets the application deal with human-readable representation of the email address.</p> <p>Convert a native name to its MIME-encoded format by using <code class="function">setDisplayName()</code> followed by <code class="function">getName()</code>. Similarly, decode a MIME-encoded name by using <code class="function">setName()</code> followed by <code class="function">getDisplayName()</code>.</p> <p>Convert an email address to its IDNA-encoded format by using <code class="function">setDisplayAddr()</code> followed by <code class="function">getAddr()</code>. Similarly, decode an IDNA-encoded name by using <code class="function">setAddr()</code> followed by <code class="function">getDisplayAddr()</code>.</p> <p>The <code class="function">toString</code> and <code class="function">fromString</code> methods are templates, and may be used with a vector of <span class="structname">mail::emailAddress</span> or <span class="structname">mail::address</span> objects. The two classes are completely interchangable. A <span class="structname">mail::emailAddress</span> object may be assigned or converted to a <span class="structname">mail::address</span>, and vice-versa.</p> </div> <div class="refsect1" title="SEE ALSO"> <a id="id605284" shape="rect" name="id605284"> </a> <h2>SEE ALSO</h2> <p><a class="link" href="address.html" title="mail::address" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::address</span>(3x)</span></a>, <a class="link" href="mail-setappcharset.html" title="mail::setAppCharset" shape="rect"><span class="citerefentry"><span class="refentrytitle">mail::setappcharset</span>(3x)</span></a>.</p> </div> </div> <div class="navfooter"> <hr/> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left" rowspan="1" colspan="1"> <a accesskey="p" href="mail-attachments.html" shape="rect">Prev</a> </td> <td width="20%" align="center" rowspan="1" colspan="1"> <a accesskey="u" href="misc.html" shape="rect">Up</a></td> <td width="40%" align="right" rowspan="1" colspan="1">  <a accesskey="n" href="envelope.html" shape="rect">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top" rowspan="1" colspan="1">mail::Attachment </td> <td width="20%" align="center" rowspan="1" colspan="1"> <a accesskey="h" href="index.html" shape="rect">Home</a> | <a accesskey="t" href="bk01-toc.html" shape="rect">ToC</a></td> <td width="40%" align="right" valign="top" rowspan="1" colspan="1"> mail::envelope</td> </tr> </table> </div> </body> </html>