
/*
Example of use:

  smail_new(&m,"localhost",25);
  smail_header(m,envfrom,from,to,cc,bcc,subject);
  smail_printf(m,"Body of message\n");
  smail_printf(m,"\n");
  smail_error(m);
  smail_free(&m);

*/
#include "tcplib.h"
#include "defines.h"
#include "lib.h"
#ifndef DONE_SMAIL
#define DONE_SMAIL 1

typedef struct SMAIL {Chan *c; char reason[BFSZ]; char host[BFSZ]; char helo[BFSZ]; int addheaders; FILE *log; int log_pass;} Smail;
int smail_header_login(Smail *m,char *envfrom,char *from,char *to,char *cc, char *bcc, char *subject, char *user, char *pass);
int smail_set_helo(Smail *m, char *helo);
int smail_new(Smail **im, char *host, int port, FILE *log);
char *smail_error(Smail *m);
int smail_response(Smail *m);
int smail_header(Smail *m,char *envfrom,char *from,char *to,char *cc, char *bcc, char *subject);
int smail_header2(Smail *m); // call from/rctp first.
int smail_printf(Smail *out,char *arg_list,...);
int smail_internal(Smail *m, char *xpass);

int smail_close(Smail **out);
int smail_send(Smail *m);
int smail_set_host(Smail *m, char *host);
int smail_addheaders(Smail *m, int t);
int smail_rcpt(Smail *m, char *rcpt);
int smail_from(Smail *m, char *rcpt);
int smail_set_debug(int x);
int smail_send_file(Smail *m, char *fname);
int smail_login(Smail *m, char *user, char *pass);
int smail_send_rcpts(Smail *msg, Pair *rcpts_to, int dsn, char *result, int *nrcpt);
int smail_sentstore(Smail *m, char *folder);
int smail_write(Smail *m,char *str, int len);

#endif
