{
    return "# bayes disabled" unless (($spamassassin{UseBayes} || 1) eq 0);

    my $AutoLearn = $spamassassin{UseBayesAutoLearn} || 0;
    # default SA value of 12 is too high
    my $BayesAutoLearnThresholdSpam = $spamassassin{'BayesAutoLearnThresholdSpam'}||6;
    # 0.10 is spamassassin default but it is too high, set to -1.15.
    my $BayesAutoLearnThresholdNonspam = $spamassassin{'BayesAutoLearnThresholdNonSpam'}|| -1.15;

    # should get at least 6: 3 from body and 3 from header.
    # http://spamassassin.apache.org/full/3.1.x/doc/Mail_SpamAssassin_Plugin_AutoLearnThreshold.html
    $BayesAutoLearnThresholdSpam = 6 unless $BayesAutoLearnThresholdSpam >= 6;

    $OUT =  "bayes_auto_learn $AutoLearn\n";
    return unless $AutoLearn == 1;
    $OUT .= "bayes_auto_learn_threshold_nonspam  $BayesAutoLearnThresholdNonspam\n";
    $OUT .= "bayes_auto_learn_threshold_spam $BayesAutoLearnThresholdSpam\n";
}
