{

 

 

"SampleFilter", /*

filter name */

SMFI_VERSION,

/*

version code -- do not change */

SMFIF_ADDHDRS,

/*

flags */

NULL,

/*

connection info filter */

NULL,

/*

SMTP HELO command filter */

mlfi_envfrom,

/*

envelope sender filter */

NULL,

/*

envelope recipient filter */

mlfi_header,

/*

header filter */

mlfi_eoh,

/*

end of header */

mlfi_body,

/*

body block filter */

mlfi_eom,

/*

end of message */

mlfi_abort,

/*

message aborted */

mlfi_close

/*

connection cleanup */

};

 

 

int

 

 

main(argc, argv)

 

 

int argc;

 

 

char *argv[];

 

 

{

 

 

bool setconn = false; int c;

const char *args = "p:";

/* Process command line options */

while ((c = getopt(argc, argv, args)) != -1)

{

switch (c)

{

case 'p':

if (optarg == NULL *optarg == '\0')

{

(void) fprintf(stderr,"Illegal conn: %s\n", optarg);

exit(EX_USAGE);

}

(void) smfi_setconn(optarg); setconn = true;

break;

}

}

if (!setconn)

{

fprintf(stderr, "%s: Missing required -p argument\n", argv[0]); exit(EX_USAGE);

}

if (smfi_register(smfilter)== MI_FAILURE)

{

fprintf(stderr, "smfi_register failed\n"); exit(EX_UNAVAILABLE);

}

return smfi_main();

}

/* eof */

*** example taken from the sendmail.org documentation*******

Mail Filter Example 271

Page 271
Image 271
HP UX Internet Express Software manual Smfiversion