Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 795

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head profile="http://internetalchemy.org/2003/02/profile">
  <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" />
  <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
  <meta name="dc.title" content="17. Internet Services" />
  <meta name="dc.subject" content="17. Internet Services" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" />
  <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="parent" href="internetservices.html" title="Chapter Contents" />
  <link rel="prev" href="uriqa.html" title="URIQA Semantic Web Enabler" />
  <link rel="next" href="nntpnewsgroups.html" title="NNTP Newsgroups" />
  <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="doc.css" />
  <link rel="stylesheet" type="text/css" href="/doc/translation.css" />
  <title>17. Internet Services</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="copyright" content="OpenLink Software, 1999 - 2009" />
  <meta name="keywords" content="" />
  <meta name="GENERATOR" content="OpenLink XSLT Team" />
 </head>
 <body>
  <div id="header">
    <a name="maildelivstore" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>17. Internet Services</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="internetservices.html">Chapter Contents</a> | <a class="link" href="uriqa.html" title="URIQA Semantic Web Enabler">Prev</a> | <a class="link" href="nntpnewsgroups.html" title="NNTP Newsgroups">Next</a>
   </div>
  </div>
  <div id="currenttoc">
   <form method="post" action="/doc/adv_search.vspx">
    <div class="search">Keyword Search: <br />
        <input type="text" name="q" /> <input type="submit" name="go" value="Go" />
    </div>
   </form>
   <div>
      <a href="http://www.openlinksw.com/">www.openlinksw.com</a>
   </div>
   <div>
      <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a>
   </div>
    <br />
   <div>
      <a href="index.html">Book Home</a>
   </div>
    <br />
   <div>
      <a href="contents.html">Contents</a>
   </div>
   <div>
      <a href="preface.html">Preface</a>
   </div>
    <br />
   <div class="selected">
      <a href="internetservices.html">Internet Services</a>
   </div>
    <br />
   <div>
      <a href="webdavserver.html">WebDAV Server</a>
   </div>
   <div>
      <a href="uriqa.html">URIQA Semantic Web Enabler</a>
   </div>
   <div class="selected">
      <a href="maildelivstore.html">Mail Delivery &amp; Storage</a>
    <div>
        <a href="#smtpclient" title="The SMTP Client">The SMTP Client</a>
        <a href="#pop3server" title="POP3 Server">POP3 Server</a>
        <a href="#smtpreceipt" title="Storing Email in Virtuoso">Storing Email in Virtuoso</a>
    </div>
   </div>
   <div>
      <a href="nntpnewsgroups.html">NNTP Newsgroups</a>
   </div>
   <div>
      <a href="mime.html">MIME &amp; Internet Messages</a>
   </div>
   <div>
      <a href="ftpservices.html">FTP Services</a>
   </div>
   <div>
      <a href="vspguide.html">VSP Guide</a>
   </div>
   <div>
      <a href="ldap.html">LDAP</a>
   </div>
    <br />
  </div>
  <div id="text">
    <a name="maildelivstore" />
    <h2>17.3. Mail Delivery &amp; Storage</h2>

  <a name="smtpclient" />
    <h3>17.3.1. The SMTP Client</h3>



<div class="funcsynopsis">
    
      <div class="funcsynopsis">
        <a name="fproto_smtp_send" />
        <span class="funcdef"> <a href="fn_smtp_send.html">
            <span class="function">smtp_send</span>
          </a>
        </span>
        (<span class="paramdef">in <span class="parameter">server</span>  string</span>, 
        <span class="paramdef">in <span class="parameter">sender</span>  string</span>, 
        <span class="paramdef">in <span class="parameter">recipient</span>  string</span>, 
        <span class="paramdef">in <span class="parameter">body</span>  string</span>);
      </div>
    </div>
    <p>send message to SMTP server</p>






  <br />

  <a name="pop3server" />
    <h3>17.3.2. POP3 Server</h3>

<p>The Virtuoso POP3 Server implementation supports the following commands
as defined in RFC - 1939:</p>

<ul>
      <li>DELE</li>
      <li>LIST</li>
      <li>NOOP</li>
      <li>PASS</li>
      <li>QUIT</li>
      <li>RETR</li>
      <li>RSET</li>
      <li>STAT</li>
      <li>TOP</li>
      <li>UIDL</li>
      <li>USER</li>
    </ul>

<p>The POP3 Server listening port is configured in the HTTP section of the virtuoso.ini.</p>
	<p>
POP3Port = xxx, in HTTP section.
</p>
	<p>
If the port is not defined in the configuration file then the POP3 server subsystem will be disabled.
</p>
	<p>
Users and passwords of the POP3 Server are described in the system view
WS.WS.SYS_DAV_USER over SYS_USERS. These users can be administered from the users section of the
Virtuoso Administration User Interface.
</p>
	<p>
The system table DB.DBA.MAIL_MESSAGE is used to stored the messages.
</p>

<br />


	<a name="smtpreceipt" />
    <h3>17.3.3. Storing Email in Virtuoso</h3>

    <p>
A generic mail delivery driver enables SMTP servers to deliver email to be stored in either
Virtuoso or non Virtuoso SQL database.
</p>
<p>
Mail storage can occur in a number of ways:</p>
<ol>
      <li>Replacing the default generic SMTP mail handler ( the program  &quot;procmail&quot;)</li>
      <li>Replacing the mail storage settings for individual users
Replacing Default SMTP Mail Handler Sendmail</li>
    </ol>

  <a name="unixsendmailinstall" />
    <h4>17.3.3.1. Replacing procmail As Default Mail Handler In Sendmail Configurations</h4>
<p>
When this configuration is in use, the mails for all of your
&quot;sendmail&quot; mail recipients are written to a SQL Database table.
</p>

<ol>
    <li>
        <p>Copy the file &quot;odbc_mail.default.ini&quot; to &quot;/etc/odbc_mail.ini&quot;</p>
<p>
          <span class="important">
            <strong>Important:</strong> Make sure that /etc/odbc_mail.ini is NOT GROUP/WORLD writable.  virt_mail
will fail to run if it is.</span>
        </p>
    </li>
    <li>
        <p>Copy or symbolically link the file &quot;virt_mail&quot; to &quot;/usr/bin/virt_mail&quot;</p>
    </li>
      <li>
        <p>Edit /etc/odbc_mail.ini and change the login settings to match your current database installation.</p>
<p>Note: If you don&#39;t have or want to use procmail, comment out the &quot;Fallback&quot; setting in the &quot;[Deliver]&quot; section.</p>
</li>
      <li>
        <p>Edit the file &quot;/etc/sendmail.cf&quot; as described below:</p>
<p>Change</p>
<div>
          <pre class="programlisting">
Mlocal, P=/usr/bin/procmail, F=lsDFMAw5:/|@qSPfhn9, S=10/30,
  R=20/40,T=DNS/RFC822/X-Unix, A=procmail -Y -a $h -d $u
</pre>
        </div>
<p>
To:
</p>
<div>
          <pre class="programlisting">
Mlocal, P=/usr/bin/virt_mail, F=lsDFMA5:/|@qSPhn9, S=10/30,
  R=20/40, T=DNS/RFC822/X-Unix, A=virt_mail -c /etc/odbc_mail.ini -l $u -s $g
</pre>
        </div>
<p>
NOTE: The changes to the F= setting involves removing both the &#39;w&#39; and &#39;f&#39; flags.
</p>
<p>
The removal of the &#39;w&#39; flag affects lookups in /etc/passwd, which are no
longer required if all mail delivery goes into a SQL Database.  The default
ini file is set up to maildrop via procmail, which will perform the check correctly.
</p>
</li>
    </ol>
<br />

<a name="replacingmailsettings" />
    <h4>17.3.3.2. Replacing The Mail Storage Settings For Individual Users</h4>

<a name="sendmail" />
    <h5>17.3.3.2.1. Using Sendmail</h5>

<ol>
    <li>
        <p>Copy odbc_mail.default.ini to ~the_user_name/odbc_mail.ini</p>
<p>
          <span class="important">
            <strong>Important:</strong> Make sure that /etc/odbc_mail.ini is NOT GROUP/WORLD writable.  virt_mail
will fail to run if it is.</span>
        </p>
    </li>
      <li>
        <p>At the end of the file ~the_user_name/.procmailrc put something like:
</p>
<div>
          <pre class="programlisting">
:0:
| /usr/bin/virt_mail -c .odbc_mail.ini -l the_user_name
</pre>
        </div>
<p>
replacing the_user_name with the user you are setting up.
</p>
<p>
Note: the &#39;-l ..&#39; parameter is used to relate the local recipient to
the database user for which the maildrop is done.  See the remarks in
the odbc_mail.default.ini file.
</p>
</li>
      <li>
<p>Adjust the parameters in .odbc_mail.ini to match your configuration</p>
<p>
          <span class="important">
            <strong>Important:</strong> disable Fallback delivery in the .odbc_mail.ini file.</span>
Comment out the &quot;Fallback =&quot; entry in the .odbc_mail.ini
or set it to something that does not involve procmail.  This may lead to drop loops, otherwise.
</p>
</li>
    </ol>
<br />

<a name="qmail" />
    <h5>17.3.3.2.2. Using Qmail</h5>
<ol>
    <li>
        <p>Copy odbc_mail.default.ini to ~the_user_name/.odbc_mail.ini
</p>
<p>
          <span class="important">
            <strong>Important:</strong> Make sure that the .odbc_mail.ini file is NOT GROUP/WORLD writable.
virt_mail will fail to run if it is.</span>
        </p>
    </li>
      <li>
        <p>If you are setting up a .qmail, you can simply do the following:
</p>
<div>
          <pre class="programlisting">
| /usr/bin/virt_mail -m qmail -c .odbc_mail.ini
</pre>
        </div>
<p>
If you are setting up .qmail-default or .qmail-&lt;some_alias_name&gt;,
make sure you adjust the RemovePrefix accordingly in the odbc_mail.ini.
</p>
<p>
This also works if a single user is receiving mail for an entire
(virtual) domain.
</p>
<p>
If you want to configure qmail so that user &#39;db&#39; gets all mail for
example.com, do the following:
</p>
<ol>
      <li>
            <p>create a new user db in /etc/passwd etc.</p>
      </li>
      <li>
            <p>remove example.com from /var/qmail/control/locals</p>
      </li>
          <li>
            <p>add to /var/qmail/controls/virtualdomains: </p>
<div>
              <pre class="programlisting">
example.com:db
</pre>
            </div>
</li>
      <li>
            <p>adjust /var/qmail/users/assign accordingly:</p>
<div>
              <pre class="programlisting">
=db:db:&lt;uid&gt;:&lt;gid&gt;:&lt;home&gt;:::
</pre>
            </div>
<div>
              <pre class="programlisting">
+db-:db:&lt;uid&gt;:&lt;gid&gt;:&lt;home&gt;:-::
</pre>
            </div>
<p>or run qmail-pw2u &lt; /etc/passwd &gt; /var/qmail/users/assign
  then run qmail-newu and restart qmail</p>
      </li>
          <li>
            <p>in ~db/.qmail-default, put:</p>
<div>
              <pre class="programlisting">
| /usr/bin/virt_mail -m qmail -c .odbc_mail.ini
</pre>
            </div>
</li>
      <li>
            <p>in .odbc_mail.ini, set:</p>
<div>
              <pre class="programlisting">
RemovePrefix=db-
</pre>
            </div>
<p>
Now, mail to info@example.com will be delivered to the qmail alias
db-info@example.com and is stored into the database for user &#39;info&#39;.
</p>
      </li>
        </ol>
</li>
      <li>
<p>Adjust the parameters in .odbc_mail.ini to match your configuration</p>
</li>
    </ol>
<br />

<a name="courier" />
    <h5>17.3.3.2.3. Using Courier</h5>
<ol>
    <li>
        <p>Copy odbc_mail.default.ini to ~the_user_name/.odbc_mail.ini
</p>
<p>
          <span class="important">
            <strong>Important:</strong> Make sure that the .odbc_mail.ini file is NOT GROUP/WORLD writable.
virt_mail will fail to run if it is.</span>
        </p>
    </li>
      <li>
        <p>If you are setting up a .courier, you can simply do the following:
</p>
<div>
          <pre class="programlisting">| /usr/bin/virt_mail -mcourier -c .odbc_mail.ini</pre>
        </div>
  <p>
If you are setting up .courier-default or .courier-&lt;some_alias_name&gt;,
make sure you adjust the RemovePrefix accordingly in the .odbc_mail.ini.
</p>
<p>Note: although courier is very similar to qmail in this respect,
it is different from qmail in how it handles exit codes.
If you use -mqmail while running under courier, you&#39;ll get the wrong
exit codes, so mail is bounced instead of retried.
</p>
<p>Note also that if delivering to multiple recipients in a .courier file,
make sure the virt_mail is specified first.  This is because if the
virt_mail fails with a temporary error, the other recipients will
get another drop when courier re-attempts to deliver the mail.
</p>
<p>
Right:
</p>
\w<div>
          <pre class="programlisting">
| /usr/bin/virt_mail -mcourier -c .odbc_mail.ini
./Maildir
</pre>
        </div>
<p>Wrong:</p>
<div>
          <pre class="programlisting">
./Maildir
| /usr/bin/virt_mail -mcourier -c .odbc_mail.ini
</pre>
        </div>
</li>
      <li>
Adjust the parameters in .odbc_mail.ini to match your configuration
</li>
    </ol>
<br />

<a name="exim" />
    <h5>17.3.3.2.4. Using EXIM</h5>

<p>
Here are code snippets for Exim that perform maildrops into the odbc database.
</p>
<div>
      <pre class="programlisting">
## IN TRANSPORT SECTION

# Delivers into the database
odbc:
  driver = pipe
  command = /usr/bin/virt_mail \
	-c /etc/odbc_mail.ini \
	-s &quot;${if def:return_path{$return_path}{MAILER-DAEMON}}&quot; \
	-l &quot;$local_part&quot;
  user = USERNAME
  return_path_add
  delivery_date_add
  prefix =
  suffix =
  temp_errors = 73 : 74 : 75
  return_fail_output

# NOTE: Make sure the USERNAME in the &#39;user = USERNAME&#39; setting matches
# the owner of /etc/odbc_mail.ini, because this file must have mode 0600.
# Consider creating a new user account for this delivery only.
# You should specify &#39;user = root&#39; here only if Fallback delivery is
# configured in /etc/odbc_mail.ini (for procmail fallback delivery
# for instance)


## IN DIRECTORS SECTION

# Attempts delivery of all mail into the database
to_db:
  driver = smartuser
  transport = odbc
  require_files = /etc/odbc_mail.ini
  #
  # uncomment line below to deliver all mail to db-XXX into the database, for any
  # value of XXX. For this to work, set &quot;RemovePrefix = db-&quot; in
  # the [Translate] section in /etc/odbc_mail.ini
  #prefix = db-
</pre>
    </div>

<br />
<br />


<a name="mailsystables" />
    <h4>17.3.3.3. Mail System Tables</h4>

	<p>
The electronic mail accounts are regular SQL accounts.
</p>
	<p>
Id (MM_ID) of the message is unique per account/folder (folder can be &#39;Inbox&#39; etc.)
</p>

<div class="tip">
      <div class="tiptitle">See Also:</div>
    <p>
        <a href="systemtables.html#smtptabledesc">Mail system tables</a>
    </p>
    </div>

<br />


<a name="pop3client" />
    <h4>17.3.3.4. Pop3 Client</h4>

<p>The Virtuoso POP3 Client implementation can retrieve messages from any POP3 server.</p>



<div class="funcsynopsis">
    
      <div class="funcsynopsis">
        <a name="fproto_pop3_get" />
        <span class="funcdef">array <a href="fn_pop3_get.html">
            <span class="function">pop3_get</span>
          </a>
        </span>
        (<span class="paramdef">in <span class="parameter">host</span> varchar</span>, 
        <span class="paramdef">in <span class="parameter">user</span> varchar</span>, 
        <span class="paramdef">in <span class="parameter">password</span> varchar</span>, 
        <span class="paramdef">in <span class="parameter">buffer_size</span> integer</span>, 
        <span class="paramdefoptional">[in <span class="optional">command</span> varchar]</span>, 
        <span class="paramdefoptional">[in <span class="optional">exclude_uidl_list</span> vector]</span>);
      </div>
    </div>
    <p>get messages from a POP3 server</p>




<a name="commands" />
    <h5>17.3.3.4.1. Commands</h5>

<p>UIDL - get only UIDL&#39;s of messages.</p>
<p>DELETE - delete messages after downloading.</p>

<a name="" />
    <div class="example">
<div class="exampletitle">Examples</div>

<p>
1. To get 10 KB. messages from the server  &#39;openlinksw.com&#39; POP3 port 110, user name &#39;user_1&#39;, password  &#39;pass_1&#39;
</p>
<div>
        <pre class="programlisting">
	Pop3_get (&#39;openlinksw.com:110&#39;, &#39;user_1&#39;, &#39;pass_1&#39;, 10000);
</pre>
      </div>
<p>
2. To get  and delete 5 KB. messages from the server  &#39;openlinksw.com&#39; POP3 port 110, user name &#39;user_1&#39;,  password  &#39;pass_1&#39;
</p>
<div>
        <pre class="programlisting">
	Pop3_get (&#39;openlinksw.com:110&#39;, &#39;user_1&#39;, &#39;pass_1&#39;, 5000, &#39;DELETE&#39;);
</pre>
      </div>
<p>
3. To get  UIDL&#39;s of 100 kb. messages from the server  &#39;openlinksw.com&#39; POP3 port 110, user name &#39;user_1&#39;,  password  &#39;pass_1&#39;
</p>
<div>
        <pre class="programlisting">
	Pop3_get (&#39;openlinksw.com:110&#39;, &#39;user_1&#39;, &#39;pass_1&#39;, 100000, &#39;UIDL&#39;);
</pre>
      </div>
</div>
		<br />
	<br />
	
		<a name="mailsink" />
    <h4>17.3.3.5. The Virtuoso Mail Sink</h4>
		<p>The Virtuoso Sink is used to store messages received by Windows 2000 IIS SMTP Service into the MAIL_MESSAGES
table in Virtuoso.  It consists of an executable, run as a service, and a VBscript for registering a COM object with the IIS,
interfacing it with the Virtuoso Sink</p>
		<p>The User ID(s) in MAIL_MESSAGES to whom the message belongs to is determined by
parsing the To: field in the mail message into a list of recipients.  For each entry in the list,
if an @-sign is found, the user ID will consist of the characters to the left of it, otherwise the whole entry is used.</p>
		
			<a name="" />
    <h5>17.3.3.5.1. Registry Entries for the Virtuoso Sink.</h5>
			<div>
      <pre class="programlisting">&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; VirtuosoSink.reg
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\OpenLink Software\VirtuosoSink]
&quot;User&quot;=&quot;dba&quot;
&quot;Password&quot;=&quot;dba&quot;
&quot;DSN&quot;=&quot;Virtuoso&quot;
&quot;ConnectionCount&quot;=dword:00000001
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; VirtuosoSink.reg</pre>
    </div>

			<p>These are the registry entries used by the Sink service.  ConnectionCount is the number of connections to Virtuoso to be pooled.</p>
		<br />
		
			<a name="" />
    <h5>17.3.3.5.2. Installation</h5>
			<p>Use these commands to install the Virtuoso Sink:</p>
			<ul>
      <li>VirtuosoSink /RegServer Registers the COM Object VirtuosoSink.SMTP into the registry</li>
      <li>VirtuosoSink /Service Creates the Service in Manual start mode</li>
      <li>cscript smtpreg.vbs /add 1 OnArrival Virtuoso_SMTP_Sink VirtuosoSink.SMTP &quot;mail from=*&quot; - Registers the COM Object as a mail sink with the IIS SMTP service.</li>
    </ul>
			<div class="tip">
      <div class="tiptitle">See Also:</div>
      <p>
        <a href="http://msdn.microsoft.com/library/psdk/cdosys/_cdosys_implementing_sinks_with_scripting_languages.htm">The MSDN page</a> for more information about registering sinks.</p>
    </div>
		<br />
		
			<a name="" />
    <h5>17.3.3.5.3. Sink Operation</h5>
			<p>When the service starts it opens a pool of connections to Virtuoso and
      waits for a COM event. When the COM callback gets called, the service
      invokes a stored procedure and passes the message text to it. The procedure
      then stores the message into the database. In event of lost connection to
      the database, the service would try once to re-establish it and re-execute
      the stored procedure call. Errors and successful message routings are
      entered into the Windows 2000 Application Log.</p>
		<br />
	<br />
  <br />
<table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="uriqa.html" title="URIQA Semantic Web Enabler">Previous</a>
          <br />URIQA Semantic Web Enabler</td>
     <td align="center" width="34%">
          <a href="internetservices.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="nntpnewsgroups.html" title="NNTP Newsgroups">Next</a>
          <br />NNTP Newsgroups</td>
    </tr>
    </table>
  </div>
  <div id="footer">
    <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div>
   <div id="validation">
    <a href="http://validator.w3.org/check/referer">
        <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
    </a>
    <a href="http://jigsaw.w3.org/css-validator/">
        <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" />
    </a>
   </div>
  </div>
 </body>
</html>