Support » Plugin: Postcards » monitor e-mails sent and recipients

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am not the program author, but I’ll throw in my 2 cents …

    If you are at all comfortable with PHP, it would not be too difficult to log senders, recipients, date and time sent, originating IP address, etc., by adding a few lines of code to the plugin.php file. Just look for the wp_mail function call and add some logging immediately after that. Here is some very simple code that would create a text file:

    $f = @fopen(LOG_FILE, 'a+');
    if ( $f ) {
      @fputs($f, date("Y-m-d h:i") . " - IP: " . $_SERVER['REMOTE_ADDR'] .
        " - SENDER: $sender RECIPIENT: $to ($name) IMAGE: $img");
      @fclose( $f );

    Note: Replace LOG_FILE with the full path (path and file name) to a writeable location on your server. You can — and probably should — use WP’s internal directory constants here.

    This would create a flat text file with a line for each ecard sent that would look something like this:

    2013-01-20 02:12 - IP: - SENDER: John Doe RECIPIENT: (Jane Doe) IMAGE: /gallery/IMG_3410.JPG

    If you wanted, you could even add $msg at the end ( ...IMAGE: $img $msg"); ) to include the text of the message the sender included.

    WARNING: My simple code above comes with some caveats:

    1. It is not designed to be highly secure. It creates a plain-text file in a publicly-accessible location.
    2. It does not scale well. Whenever someone sends an ecard, this flat text file has to be appended to. Probably not a problem on a small site, but could be an issue on busier sites.
    3. The log file will continue to grow with each new entry, eventually leading to slower response time.
    4. There is no (good) way to sort, index or even view the log file from within WP.
    5. Probably some other things I’m not even thinking of at 2:15 am …

    Use this at your own risk! But it’s a quick-and-easy / fast-and-dirty way to provide some basic logging functionality to this plugin…

    Good luck!

    Also, please note my security concerns expressed in my review and in a different support forum posting ( regarding this plugin. This plugin could be accessed remotely to send spam without any anti-spam checks! At the very least, a referrer check and CAPTCHA should be added.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘monitor e-mails sent and recipients’ is closed to new replies.