Back to index

php5  5.3.10
Functions
milter.php File Reference

Go to the source code of this file.

Functions

 milter_log ($msg)
 example milter script
 milter_init ()
 milter_connect ($connect)
 is called once, at the start of each SMTP connection
 milter_helo ($helo)
 is called whenever the client sends a HELO/EHLO command.
 milter_envfrom ($args)
 is called once at the beginning of each message, before milter_envrcpt.
 milter_envrcpt ($args)
 is called once per recipient, hence one or more times per message, immediately after milter_envfrom
 milter_header ($header, $value)
 is called zero or more times between milter_envrcpt and milter_eoh, once per message header
 milter_eoh ()
 is called once after all headers have been sent and processed.
 milter_body ($bodypart)
 is called zero or more times between milter_eoh and milter_eom.
 milter_eom ()
 is called once after all calls to milter_body for a given message.
 milter_abort ()
 may be called at any time during message processing (i.e.
 milter_close ()
 is always called once at the end of each connection.

Function Documentation

may be called at any time during message processing (i.e.

between some message-oriented routine and milter_eom).

Definition at line 120 of file milter.php.

{
       milter_log("milter_abort()");
}

Here is the call graph for this function:

milter_body ( bodypart)

is called zero or more times between milter_eoh and milter_eom.

Definition at line 99 of file milter.php.

{
       milter_log("milter_body('$bodypart')");
}

Here is the call graph for this function:

is always called once at the end of each connection.

Definition at line 128 of file milter.php.

{
       milter_log("milter_close()");
}

Here is the call graph for this function:

milter_connect ( connect)

is called once, at the start of each SMTP connection

Definition at line 41 of file milter.php.

{
       milter_log("milter_connect('$connect')");
}

Here is the call graph for this function:

milter_envfrom ( args)

is called once at the beginning of each message, before milter_envrcpt.

Definition at line 59 of file milter.php.

{
       milter_log("milter_envfrom(args[])");
       foreach ($args as $ix => $arg) {
              milter_log("\targs[$ix] = $arg");
       }
}

Here is the call graph for this function:

milter_envrcpt ( args)

is called once per recipient, hence one or more times per message, immediately after milter_envfrom

Definition at line 71 of file milter.php.

{
       milter_log("milter_envrcpt(args[])");
       foreach ($args as $ix => $arg) {
              milter_log("\targs[$ix] = $arg");
       }
}

Here is the call graph for this function:

is called once after all headers have been sent and processed.

Definition at line 91 of file milter.php.

{
       milter_log("milter_eoh()");
}

Here is the call graph for this function:

is called once after all calls to milter_body for a given message.

most of the api functions, that alter the message can only be called within this callback.

Definition at line 109 of file milter.php.

{
       milter_log("milter_eom()");
  /* add PHP header to the message */
  smfi_addheader("X-PHP", phpversion());  
}

Here is the call graph for this function:

milter_header ( header,
value 
)

is called zero or more times between milter_envrcpt and milter_eoh, once per message header

Definition at line 83 of file milter.php.

{
       milter_log("milter_header('$header', '$value')");
}

Here is the call graph for this function:

milter_helo ( helo)

is called whenever the client sends a HELO/EHLO command.

It may therefore be called between zero and three times.

Definition at line 50 of file milter.php.

{
       milter_log("milter_helo('$helo')");
}

Here is the call graph for this function:

Definition at line 32 of file milter.php.

                       {
       milter_log("-- startup --");
       milter_log("milter_init()");
       smfi_setflags(SMFIF_ADDHDRS);
}

Here is the call graph for this function:

milter_log ( msg)

example milter script

run: php-milter -D -p /path/to/sock milter.php

for details on how to set up sendmail and configure the milter see http://www.sendmail.com/partner/resources/development/milter_api/

for api details see http://www.sendmail.com/partner/resources/development/milter_api/api.html

below is a list of all callbacks, that are available through the milter sapi, if you leave one or more out they simply won't get called (e.g. if you secify an empty php file, the milter would do nothing :) this function is called once on sapi startup, here you can specify the actions the filter may take

see http://www.sendmail.com/partner/resources/development/milter_api/smfi_register.html#flags

Definition at line 25 of file milter.php.

{
       $GLOBALS['log'] = fopen("/tmp/milter.log", "a");
       fwrite($GLOBALS['log'], date("[H:i:s d.m.Y]") . "\t{$msg}\n");
       fclose($GLOBALS['log']);
}

Here is the caller graph for this function: