<HTML><HEAD>
<!-- This document was created with h2.pl -->
<TITLE>Tcp4u - SMTP related functions</TITLE></HEAD>
<BODY BACKGROUND="" BGCOLOR="#FFFFC0" TEXT="#000000">
<H1>
Tcp4u - SMTP related functions</H1>
<UL>
<LI><A HREF="#Mention1">SmtpSendMessage</A>
</UL>
<hr size=4>
<h1>
<A NAME="Mention1">SmtpSendMessage</A></h1>
<p><br>
This function sends a text string using the SMTP protocol such as described by the RFC 821.<br>
Notes:<br>
<UL><LI>The use of this function requires a previous call to Tcp4uInit().<br>
<LI>Several addressees can be specified into the szTo argument. They should be separated by a semi-colon sign.<br>
<LI>If at least one address is invalid (ie: rejected by the server), the functions returns without sending any data.<br>
<LI>The headers (ie: strings like Reply-To:, Subject:, CC:, ...) should be included at the beginning of the szMessage argument. SmtpSendMessage() only add its X-Mailer: header.<br>
<LI>The function uses the smtp port such as mentioned in the file <i>services</i>. By default, it uses the port 25.<br>
<LI>A successful return code does not warranty the delivery of the message, just that if the delivery fails, the sender will receive a notification.<br>
</UL> <pre>
Syntax: SmtpSendMessage (LPCSTR szFrom,
LPCSTR szTo,
LPCSTR szMessage,
LPCSTR szServer,
LPCSTR szLocalDomain)
</pre>
<pre>
</pre>
<p><tt>Arguments:</tt><br>
</p>
<TABLE><TR align="left">
<TD colspan=1 align="left">szFrom <BR></TD>
<TD colspan=1 align="left">The SMTP address of the sender <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">szTo <BR></TD>
<TD colspan=1 align="left">The addressees. They should be separated by semi-colons. <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">szMessage <BR></TD>
<TD colspan=1 align="left">The message to be sent. <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">szServer <BR></TD>
<TD colspan=1 align="left">The local SMTP server. <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">szLocalDomain <BR></TD>
<TD colspan=1 align="left">The local domain name. If no domain is to be precised, this argument should be set NULL <BR></TD></TR></TABLE><p><br>
<tt>Returns:</tt><br>
</p>
<TABLE><TR align="left">
<TD colspan=1 align="left">SMTP4U_UNEXPECTEDANSWER <BR></TD>
<TD colspan=1 align="left">This answer is not mentioned into the RFC <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_SERVICECLOSED <BR></TD>
<TD colspan=1 align="left">Server has closed connection: service unavailable <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_NOTIMPLEMENTED <BR></TD>
<TD colspan=1 align="left">Command not implemented <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_MIMENOTSUPPORTED <BR></TD>
<TD colspan=1 align="left">8-bits extension not supported by this server <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_SERVERCANTEXECUTE <BR></TD>
<TD colspan=1 align="left">The Server refused the command <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_CANTCONNECT <BR></TD>
<TD colspan=1 align="left">Tcp4u can not establish a session with the specified server on the smtp port <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_DATAERROR <BR></TD>
<TD colspan=1 align="left">Various network errors <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_SYNTAXERROR <BR></TD>
<TD colspan=1 align="left">The sent command is rejected by the server. Bad arguments. <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_STORAGEEXCEDED <BR></TD>
<TD colspan=1 align="left">Addressee's mailbox is full <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_UNKNOWNUSER <BR></TD>
<TD colspan=1 align="left">User is unknown or address is invalid <BR></TD></TR><TR align="left">
<TD colspan=1 align="left">SMTP4U_SUCCESS <BR></TD>
<TD colspan=1 align="left">Message is now managed by the server <BR></TD></TR></TABLE>
<pre>
Example :
SmtSendMessage ("me@mydomain.net", "ark@foo.net; evan@xyz.net; me",
"Subject: Hello\r\nHello guys", "smtp.mydomain.net",
"mydomain.net");
</pre>
</body></html>
<hr size=4>
<table border=1 CELLPADDING=7 align=center><tr>
<td><A HREF="tcp4u.htm">Overview</A></td>
<td><A HREF="tcp4u_p1.htm">Multi purpose func.</A></td>
<td><A HREF="tcp4u_p2.htm">TCP functions</A></td>
<td><A HREF="tcp4u_p3.htm">Telnet related func</A></td>
<td><A HREF="tcp4u_p4.htm">HTTP functions</A></td>
<td><A HREF="tcp4u_p5.htm">UDP functions</A></td>
<td><A HREF="tcp4u_p6.htm">SMTP functions</A></td>
</tr></table>
<font italic size=2>
<table border=0><tr>
<td align=left>Tcp4u version 3.31 by Ph. Jounin and Laurent Le Bras</td>
<td align=right>Last updated: 10th march 1998</td>
<tr>
</table>
</font>
syntax highlighted by Code2HTML, v. 0.9.1