Current time: 11-22-2024, 11:36 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[UPDATED] Roundcube Fetchmail Plugin v0.2
Author Message
wynni Offline


Posts: 4
Joined: Sep 2010
Reputation: 0
Post: #11
RE: [UPDATED] Roundcube Fetchmail Plugin v0.2
nein das perlskript (cronjob geplant) liest die daten aus mysql aus und schreibt sie in die /etc/fetchmailrc. lösche ich nun einen eintrag in der db holt sich das skript wieder die daten aus der db und überschreibt das file...

Code:
#!/usr/bin/perl
  
   use DBI;
  
   $db_database="roundcubedb";
   $db_username="roundcubeuser";
   $db_password="password";
   $text='#fetchmailrc
   #dieses Fetchmailrd File wird von /var/mail/fetchmail.pl erzeugt.
  
  defaults:
  timeout 300
  antispam -1
  batchlimit 100
  
$dbh = DBI->connect("DBI:mysql:$db_database", $db_username,   $db_password) or die "Database connection error: $DBI::errstr\n";
  
  $sth = $dbh->prepare("SELECT mailget_id,userhere,remoteserver,remoteuser,remotepass,type,options,active FROM virtual_fetchmail WHERE active='y' ORDER BY remoteserver ASC");
  $sth->execute;
  while(my ($mailget_id,$userhere,$remoteserver,$remoteuser,$remotepass,$type,$options,$act​ive) = $sth->fetchrow_array()) {
          $text.="\npoll $remoteserver with proto $type\n";
          if ( $options eq 'n' ) { $keep='keep'; } else { $keep=''; }
          $text.="\tuser \"$remoteuser\" there with password \"$remotepass\" is \"$userhere\" here $keep\n";
  }
  
  $dbh->disconnect();
  open(DA, ">/etc/fetchmailrc") or die "Can't Open File.";
  print DA $text;
  close(DA);

wynni


P.S. bin auf das plugin gespannt....
09-18-2010 03:07 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [UPDATED] Roundcube Fetchmail Plugin v0.2 - wynni - 09-18-2010 03:07 AM

Forum Jump:


User(s) browsing this thread: 4 Guest(s)