Sending email direct to qmail-queue with DKIM
1/24/2010 05:07:00 PM
Posted by johnhomer
#!/usr/bin/perl # John Homer H Alvero # Oct 24, 2008 use Mail::QmailQueue; use Mail::DomainKeys::Message; use Mail::DomainKeys::Key::Private; $FinalString = <<EOS; From: user\@domain.com MIME-Version: 1.0 Subject: Hello World To: target\@gmail.com Test Email! This mail should have valid domain keys. EOS open my $fh_message, '<', \ $FinalString; my $mail = load Mail::DomainKeys::Message(File => $fh_message) or die "unable to load message"; my $priv = load Mail::DomainKeys::Key::Private(File => "/path/to/private/key/file") or die "unable to load key"; $mail->sign(Method => "nofws", Selector => "private", Private => $priv); $signature = $mail->signature->as_string; my $qmail = Mail::QmailQueue->new("/var/qmail/bin/qmail-queue"); $qmail->sender('[email protected]'); $qmail->recipient('[email protected]'); $qmail->data('DomainKey-Signature: ' . $signature .';' . "\r\n" . $FinalString); $qmail->send; close fh_message;
You can also view the script here.
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
perl,
qmail
. Follow any responses to this post through RSS. You can leave a response, or trackback from your own site.
Subscribe to:
Post Comments (Atom)
Post a Comment