# Add spamshield methods ## Introduction Powermail adds spamshield methods per default. If you want to add own spamshield methods or if you want to override a original method, you can do that with a bit of TypoScript and a PHP-file. Maybe you want to: * Validate IP addresses * Validate duplicate entries * Add external spam prevention methods * Something else... ## Small example Just define which classes should be used. Every method like \*Finisher() will be called - e.g. myFinisher(): ``` plugin.tx_powermail.settings.setup { spamshield.methods { 10 { class = Vendor\Ext\Domain\Validator\Spamshield\SpamPreventionMethod } } } ``` Add a php-file and extend your class with the AbstractMethod from powermail: ``` configuration['myConfiguration']; foreach ($this->mail->getAnswers() as $answer) { if ($answer->getField()->getMarker() === 'markerName') { if ($answer->getValue() === 'foo') { // if spam recognized, return true return false; } } } return true; } } ``` ## Some notices * Method spamCheck() will be called always * The method initialize() and initializeSpamCheck() will always be called at first * Per default 1 - 7 is already in use from powermail itself (HoneyPodMethod, LinkMethod, NameMethod, etc...).