Skip to content

Submit ham

This call is intended for the submission of false positives - items that were incorrectly classified as spam by Akismet. It takes identical arguments as comment check and submit spam.

Client->submitHam(Comment $comment): void

Remember that, as explained in the submit spam documentation, you should ensure that any values you're passing here match up with the original and corresponding comment check call.

See the Akismet API documentation for more information.


Comment $comment

The user Comment to be submitted, incorrectly classified as spam.


Ideally, it should be the same object as the one passed to the original comment check API call.

Return value


The method throws a ClientException when an error occurs. The exception getMessage() usually includes some debug information, provided by the X-akismet-debug-help HTTP header, about what exactly was invalid about the call.


use yii\akismet\{Author, Client, ClientException, Comment};

try {
    $client = new Client([
        "apiKey" => "123YourAPIKey",
        "blog" => ""

    $comment = new Comment(
        new Author("", "Mozilla/5.0"),
        ["content" => "A valid user comment (ham)"]

    $result = $client->checkComment($comment); // `true`, but `false` expected.
        // Got `CheckResult::isSpam`, but `CheckResult::isHam` expected.

    print "The comment was incorrectly classified as spam.";

catch (ClientException $e) {
    print "An error occurred: {$e->getMessage()}"