|
![[Cosm Logo]](images/cosmlogo.gif)
Email Functions
v3EmailSMTP
Syntax
#include "email.h"
s32 v3EmailSMTP( const u32 smtp_server, const ascii * to,
const ascii * from, const ascii * subject,
const ascii * message, u32 length );
Description
Send SMTP email message of length length with
subject using the given smtp_server host.
The To: and From: fields will be set to to and from.
SMTP is a 7-bit protocol so only plain text can be sent.
Return Values
V3_PASS on success, or an error code on failure.
Errors
- V3_EMAIL_ERROR_TO
- The TO address was rejected by the SMTP server.
- V3_EMAIL_ERROR_FROM
- The FROM address was rejected by the SMTP server.
- V3_EMAIL_ERROR_HOST
- The SMTP server specified was invalid.
- V3_EMAIL_ERROR_MESSAGE
- Message length is nonzero, but message is NULL.
- V3_EMAIL_ERROR_NORELAY
- The SMTP server specified does not permit relaying.
- V3_EMAIL_ERROR_ABORTED
- Unable to complete transmission.
Example
u32 smtp_server;
ascii * server = "127.0.0.1";
ascii * to = "foo@bar.com";
ascii * from = "cosm@bar.com";
ascii * subject = "Testing";
ascii * message = "This is a test";
u32 length;
s32 error;
length = v3u32u64( v3StrLengthA( message ) );
if ( v3NetDNS( &smtp_server, server ) == V3_PASS )
{
error = v3EmailSMTP( smtp_server, to, from, subject,
message, length );
v3PrintA( "Email%.4s sent!\n",
( ( error == V3_PASS ) ? "" : " NOT" ) );
}
else
{
v3PrintA( "DNS lookup error!\n" );
}
© Copyright Mithral Communications & Design, Inc. 1999.
All rights reserved.
Mithral(tm) and Cosm(tm) are trademarks of
Mithral Communications & Design, Inc.
Document last modified:
|