{
    $OUT = '';

    my $status = $fetchmail{"status"}
							|| 'disabled';
    my $method = $fetchmail{"Method"}
							|| 'standard';

    if ($status eq "enabled" && $method eq 'multidrop')
    {
	# Write a fetchmail command which connects to a POP
	# server, retrieves all mail from a single account,
	# and feeds it to the local SMTP server.

	my $envelopeSpec =
	    $fetchmail{"SecondaryMailEnvelope"};
	my $SecondaryMailServer =
	    $fetchmail{"SecondaryMailServer"};
	my $SecondaryMailAccount =
	    $fetchmail{"SecondaryMailAccount"};
	my $SecondaryMailPassword =
	    $fetchmail{"SecondaryMailPassword"};
	$envelopeSpec = defined $envelopeSpec ?
		"envelope \"$envelopeSpec\"\n" : "";

	my $verbosity = $fetchmail{"Verbosity"}
		    || "--silent";

	my $protocol = $fetchmail{"Protocol"}
		    || "POP3";

	my $ssl = $fetchmail{"SSL"}
		    || "disabled";

	use esmith::DomainsDB;
	my $ddb = esmith::DomainsDB->open_ro();

 	my $locals = join ' ', map { $_->key } $ddb->domains;

	$OUT .= "# multi-drop configuration; fetchmail ";
	$OUT .= "retrieves all mail from a remote POP mailbox:\n";
	$OUT .= "\n";
	$OUT .= "/usr/bin/fetchmail --syslog $verbosity ";

	my $AuthenticationMethod =
	    $fetchmail{"AuthenticationMethod"} 
		|| "password";
	$OUT .= "--auth $AuthenticationMethod ";

	$OUT .= "--fetchmailrc - <<EOF\n";
	$OUT .= "\n";
	$OUT .= "set postmaster \"postmaster\@$DomainName\"\n";
	$OUT .= "set bouncemail\n";
	$OUT .= "set properties \"\"\n";
	$OUT .= "\n";
	$OUT .= "poll $SecondaryMailServer\n";
	$OUT .= $envelopeSpec;
	$OUT .= "    protocol $protocol\n";
	$OUT .= "    ssl\n" if $ssl eq 'enabled';
	$OUT .= "    no dns\n";
	$OUT .= "    localdomains $locals\n";
	$OUT .= "       username \"$SecondaryMailAccount\" ";
	$OUT .= "password \"$SecondaryMailPassword\" to * here\n";
	$OUT .= "           smtphost 127.0.0.200" . ($smtpd{TCPPort} ? "/$smtpd{TCPPort}" : "") . "\n";
	$OUT .= "           fetchall\n";
	$OUT .= "           forcecr\n";
	$OUT .= "\n";
	$OUT .= "EOF";

    }
}
