| 1 | |||
| 2 | package Email::Blaster::MaillogWatcher::Postfix; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings 'all'; | ||
| 6 | use base 'Email::Blaster::MaillogWatcher'; | ||
| 7 | use Time::HiRes 'usleep'; | ||
| 8 | |||
| 9 | |||
| 10 | #============================================================================== | ||
| 11 | sub watch_maillog | ||
| 12 | { | ||
| 13 | my ($s, $maillog_path, $queued_as) = @_; | ||
| 14 | |||
| 15 | warn "Waiting for the message ($queued_as) to go out...\n"; | ||
| 16 | while( 1 ) | ||
| 17 | { | ||
| 18 | my $wanted = `grep $queued_as $maillog_path*`; | ||
| 19 | my $status; | ||
| 20 | unless( ($status) = $wanted =~ m/\sstatus\=(.*?)\s/i ) | ||
| 21 | { | ||
| 22 | usleep(500000); | ||
| 23 | next; | ||
| 24 | }# end until() | ||
| 25 | |||
| 26 | # We have sent it: | ||
| 27 | return lc($wanted) eq 'sent'; | ||
| 28 | }# end while() | ||
| 29 | }# end watch_maillog() | ||
| 30 | |||
| 31 | 1;# return true: | ||
| 32 |