src/Spamcop.php
public function parseAlerts()
    {

        $reports = [ ];

        preg_match_all(
            '/\s*(?<ip>[a-f0-9:\.]+)/',
            // Someone from spamcop found it funny to prefix IPv6 addresses, so lets strip that off
            str_replace('IPv6 ', '', $this->parsedMail->getMessageBody()),
            $matches
        );

        $received = $this->parsedMail->getHeaders()['date'];
        if (strtotime(date('d-m-Y H:i:s', strtotime($received))) !== (int)strtotime($received)) {
            $received = date('d-m-Y H:i:s');
        }

        if (is_array($matches) && !empty($matches['ip']) && count($matches['ip']) > 0) {
            foreach ($matches['ip'] as $ip) {
                $reports[] = [
                    'Source-IP' => $ip,
                    'Received-Date' => $received,
                    'Note' => 'A spamtrap hit notification was received.'.
                        ' These notifications do not provide any evidence.'
                ];
            }
        }

        return $reports;

    }
public function parseAlerts()
    {

        $reports = [ ];

        preg_match_all(
            '/\s*(?<ip>[a-f0-9:\.]+)/',
            // Someone from spamcop found it funny to prefix IPv6 addresses, so lets strip that off
            str_replace('IPv6 ', '', $this->parsedMail->getMessageBody()),
            $matches
        );

        $received = $this->parsedMail->getHeaders()['date'];
        if (strtotime(date('d-m-Y H:i:s', strtotime($received))) !== (int)strtotime($received)) {
            $received = date('d-m-Y H:i:s');
        }

        if (is_array($matches) && !empty($matches['ip']) && count($matches['ip']) > 0) {
            foreach ($matches['ip'] as $ip) {
                $reports[] = [
                    'Source-IP' => $ip,
                    'Received-Date' => $received,
                    'Note' => 'A spamtrap hit notification was received.'.
                        ' These notifications do not provide any evidence.'
                ];
            }
        }

        return $reports;

    }
public function parseAlerts ( ) { $ reports = [ ] ; preg_match_all ( '/\s*(?<ip>[a-f0-9:\.]+)/' , // Someone from spamcop found it funny to prefix IPv6 addresses, so lets strip that off str_replace ( 'IPv6 ' , '' , $ this -> parsedMail -> getMessageBody ( ) ) , $ matches ) ; $ received = $ this -> parsedMail -> getHeaders ( ) [ 'date' ] ; if ( strtotime ( date ( 'd-m-Y H:i:s' , strtotime ( $ received ) ) ) !== ( int ) strtotime ( $ received ) ) { $ received = date ( 'd-m-Y H:i:s' ) ; } if ( is_array ( $ matches ) && ! empty ( $ matches [ 'ip' ] ) && count ( $ matches [ 'ip' ] ) > 0 ) { foreach ( $ matches [ 'ip' ] as $ ip ) { $ reports [ ] = [ 'Source-IP' => $ ip , 'Received-Date' => $ received , 'Note' => 'A spamtrap hit notification was received.' . ' These notifications do not provide any evidence.' ] ; } } return $ reports ; }
This is a spamcop formatted alert with a multiple incidents

@return array $reports
This is a spamcop formatted alert with a multiple incidents