Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: John Crisp on November 15, 2002, 02:00:43 AM

Title: E-mail collection...again
Post by: John Crisp on November 15, 2002, 02:00:43 AM
Hi,

I have been having some fun and games with pop mail collection or lack of it on a couple of 5.1.2 SP3 servers and I wondered if someone could enlighten me a little.

I know that this is a subject that has been covered a lot before and I have read vast amounts of posts. However there is something bugging me that I can't figure out and haven't found an answer for.

In office hours are set to 15 mins and out of hours to 2 hours, weekends at not all. Seems like anytime I am outside office hours, email-ipup returns returns without triggering fetch mail. As I am no perl programmer, I put some simple flags in the file to see where it returned - you can see the echo lines. Where it seems to return is at the line

my $EmailRetrieval = db_get_prop(\%conf, "fetchmail", 'Method');

I get a response of status enabled, but not method. It jumps straight out.

Should fetchmail have double quotes ? I have tried single ones but to no avail.


If I # out the 3 lines with EmailRetrieval in them, it works a treat.

Can someone shed some light on this ?

/etc/e-smith/actions/email-ipup

sub fetchmailIfRequired()
{
    tie my %conf, 'esmith::config';

    my ($type, %properties) = db_get(\%conf, 'fetchmail');
    system("echo before ipup > /root/start.txt");
    return if (exists $properties{'NoIPUP'});
    system("echo past ip up >/root/start.txt");
    return unless (defined $properties{'status'});
    return unless ($properties{'status'} eq "enabled");
    system("echo enabled > /root/start.txt");
    my $EmailRetrieval = db_get_prop(\%conf, 'fetchmail', 'Method');
    system("echo method >start.txt");
    return unless (defined $properties{'EmailRetrieval'});
    system("echo retrieval > /root/start.txt");
    return unless ($properties{'EmailRetrieval'} =~ /^(etrn|multidrop)$/);
    system("echo etrn/multi > /root/start.txt");
    return if ( ($properties{'FreqOffice'}  eq 'never') and
                ($properties{'FreqOutside'} eq 'never') and
                ($properties{'FreqWeekend'} eq 'never') );
    system("echo fetchmail > /root/start.txt");
    system("/etc/fetchmail");



Many thanks

B. Rgds
John
Title: Re: E-mail collection...again
Post by: John Crisp on November 15, 2002, 02:20:53 AM
Just noticed something. Must be getting tired.

I got the path for the flag wrong :

system("echo method >start.txt"); should have been /root/start.txt

So I tried again with the quotes around fetchmail and this seems to cure it.

my $EmailRetrieval = db_get_prop(\%conf, "fetchmail", 'Method');

Change to :

my $EmailRetrieval = db_get_prop(\%conf, 'fetchmail', 'Method');

Anyone like to tell me the difference ?

B. Rgds
John
Title: Re: E-mail collection...again
Post by: John Crisp on November 15, 2002, 02:32:57 AM
Doh. Stops at method :

system("echo method >start.txt");

return unless (defined $properties{'EmailRetrieval'});

** doesn't get this far

system("echo retrieval > /root/start.txt");

return unless ($properties{'EmailRetrieval'} =~ /^(etrn|multidrop)$/);

system("echo etrn/multi > /root/start.txt");


Large matchsticks litter my desk. Gotta go to bed.


Have hashed out the 3 lines & will check in the morning.

B. Rgds
John
Title: Re: E-mail collection...again
Post by: John Crisp on November 15, 2002, 01:15:13 PM
Morning, and fortunately the matchsticks are still here.

Looks like it all ran to plan overnight.

So I think that there is a problem in email-ipup with :

return unless (defined $properties{'EmailRetrieval'});

But I am no perl programmer. Anyone got any ideas ?

I'd like someone to let me know what they think if possible. If I'm right, does this go to bugs ?

B. Rgds
John