home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LC
/
SEE4C10.ZIP
/
DRIVER.C
< prev
next >
Wrap
C/C++ Source or Header
|
1998-05-31
|
2KB
|
78 lines
/*
** DRIVER.C [SMTP Example Program 3]
*/
#include <windows.h>
#include <stdio.h>
#include "see.h"
/////////////////////////////////////////////////////////
////// IMPORTANT: edit these definitions before compiling
#define SMTP_HOST_NAME "smtp_host_name"
#define YOUR_EMAIL_ADDR "your_email_address"
#define SEND_TO "receipient's email address"
////// EXAMPLE //////////////////////////////////////////
// #define SMTP_HOST_NAME "mail.myisp.net"
// #define YOUR_EMAIL_ADDR "<me@myisp.com>"
// #define SEND_TO "<mike@marshallsoft.com>"
/////////////////////////////////////////////////////////
char Buffer[512];
void ErrorExit(int Code)
{seeErrorText(Code,(LPSTR)Buffer,512);
printf("ERROR %d: %s\n", Code, Buffer);
exit(0);
}
int CallDriver(void)
{int Code;
int Counter = 0;
while(1)
{Code = seeDriver();
if(Code<0) ErrorExit(Code);
if(Code==0) return 0;
if(Code!=9999)
{Counter = (Counter+1) % 10;
if(Counter==0) printf(".");
}
}
}
/*** main ***/
void main(int argc, char *argv[])
{int Code;
/* turn off AUTO CALL driver */
seeIntegerParam(SEE_AUTO_CALL_DRIVER, 0);
/* connect to server */
puts("Calling seeConnectTo()...");
Code = seeConnectTo(
(LPSTR)SMTP_HOST_NAME, /* SMTP server */
(LPSTR)YOUR_EMAIL_ADDR, /* our return email address */
(LPSTR)NULL); /* Reply-To header */
if(Code<0) ErrorExit(Code);
else CallDriver();
/* prepare email */
puts("Calling seeSendEmail()...");
Code = seeSendEmail(
(LPSTR)SEND_TO, /* To list */
(LPSTR)NULL, /* CC list */
(LPSTR)NULL, /* BCC list */
(LPSTR)"DRIVER test.", /* subject */
(LPSTR)"@test.mai", /* message in file */
(LPSTR)"test.zip"); /* attachment (MIME base-64) */
if(Code<0) ErrorExit(Code);
else CallDriver();
printf("\n%ld attachment bytes read.\n", seeStatistics(SEE_GET_ATTACH_BYTES_READ) );
printf("%ld total bytes sent.\n", seeStatistics(SEE_GET_TOTAL_BYTES_SENT) );
/* close */
puts("Calling seeClose()...");
Code = seeClose();
if(Code<0) ErrorExit(Code);
else CallDriver();
puts("Done.");
} /* end main */