home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 November / Cd users extra 14.iso / prog / inst / mailc / multi.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-14  |  2.1 KB  |  67 lines

  1. /*
  2. **  MULTI.C [edit EMAIL.H before compiling].
  3. ** 
  4. **  This program emails two messages, including a
  5. **  MIME attachment.
  6. */
  7.  
  8. // IMPORTANT: edit these definitions before compiling 
  9. #include "email.h"
  10. #define FIRST_SEND_TO   "1st receipient's email address"
  11. #define SECOND_SEND_TO  "2nd receipient's email address"
  12.  
  13. #include <windows.h>
  14. #include <stdio.h>
  15. #include "see.h"
  16.  
  17. static char Buffer[512];
  18.  
  19. void ErrorExit(int Code)
  20. {seeErrorText(Code,(LPSTR)Buffer,512);
  21.  printf("%s\n", Buffer);
  22.  exit(0);
  23. }
  24.  
  25. /*** main ***/
  26.  
  27. void main(int argc, char *argv[])
  28. {int Code; 
  29.  /* define diagnostics log file */
  30.  seeStringParam(SEE_LOG_FILE, (LPSTR)"multi.log");  
  31.  
  32.  /* connect to SMTP server */
  33.  puts("Connecting...");
  34.  Code = seeSmtpConnect(
  35.     (LPSTR)SMTP_HOST_NAME,                     /* SMTP server */
  36.     (LPSTR)YOUR_EMAIL_ADDR,                    /* our return email address */
  37.     (LPSTR)NULL);                              /* Reply-To header */
  38.  if(Code<0) ErrorExit(Code);
  39.   
  40.  /* send first email */
  41.  puts("Sending email #1 ...");
  42.  Code = seeSendEmail(
  43.     (LPSTR)FIRST_SEND_TO,                      /* To list */
  44.     (LPSTR)NULL,                               /* CC list */
  45.     (LPSTR)NULL,                               /* BCC list */
  46.     (LPSTR)"MULTI Example Program",            /* subject */
  47.     (LPSTR)"Hello from MULTI.C !!!\r\nBye!",   /* text message */
  48.     (LPSTR)NULL);                              /* no attachment */                
  49.  if(Code<0) ErrorExit(Code); 
  50.  
  51.  /* send second email */  
  52.  puts("Sending email #2 ...");
  53.  Code = seeSendEmail(
  54.     (LPSTR)SECOND_SEND_TO,                     /* To list */
  55.     (LPSTR)NULL,                               /* CC list */
  56.     (LPSTR)NULL,                               /* BCC list */    
  57.     (LPSTR)"MULTI Example Program",            /* subject */
  58.     (LPSTR)"@test.mai",                        /* message in file */
  59.     (LPSTR)"test.zip");                        /* attachment (size will be multiple of 4) */                
  60.  if(Code<0) ErrorExit(Code);
  61.  puts("Closing...");
  62.  Code = seeClose();
  63.  if(Code<0) ErrorExit(Code);
  64. } /* end main */
  65.  
  66.  
  67.