rn7.net/wiki

QuantifiedSelfVeilleOutils

PagePrincipale :: rn7.net :: DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur :: Vous êtes 38.107.179.229

Expérimentations :



Outils qui enregistrent l'activité de ma machine :


Les outils manuels de suivit d'activité (en mode déclaratif) :


Ce que je recherche :




Gestion de ses emails

(un peu hors sujet)
http://www.merkapt.com/entrepreneuriat/9_technologie/comment-se-sauver-des-emails-5693#more-5693



Analyse des mails


Outil complet


Bibliothèque Perl pour manipuler une boite IMAP

http://search.cpan.org/~jpaf/Net-IMAP-Simple-0.93/Simple.pm
http://search.cpan.org/~vparseval/Mail-MboxParser-0.55/MboxParser.pm

Fonctions PHP pour produire des statistiques IMAP

http://php.net/manual/en/book.imap.php

Script comlet pour produire des statistiques IMAP en php

http://learnbyblogging.com/?p=96
<?php
global $tdate$today;
$tdate getdate();
$today $tdate[0];
$php_out 0/* =1 if html format is desired. =0 for std text output */
$max_msg_size = -10.0;
$earliest_date $tdate[0];

$start_time time(); /* capture the start time for elapsed time calculation */
if ($php_out) {
   print 
"\n";
   print 
"<h1>Derek's INBOX Statistics:</h1>\n";
}
print 
"Derek's INBOX Statistics:\n";
$total_size 0.0;
/* Replace the following line for your application */
$mbox imap_open("{yourhost.com:993/imap/ssl/novalidate-cert}INBOX""username""your_password");
$n_msg imap_num_msg($mbox);
if (
$php_out)
   echo 
"<h2>Total number of mails = ".$n_msg."</h2>\n";
else
   echo 
"Total number of mails = ".$n_msg."\n";

for (
$i=1$i<=$n_msg$i++) {
  
$header imap_headerinfo($mbox,$i);
  if (
$header == false) {
     echo 
"Call failed\n";
     break;
  }
  else {
          
$size = (float) $header->Size;
          if (
$size $max_msg_size)
             
$max_msg_size $size ;
          
$msg_date=strtotime($header->Date);
          if (
$msg_date $earliest_date)
             
$earliest_date $msg_date;
          
$month_key date('Y-m',$msg_date);
          if ( 
is_null($msg_month[$month_key]))  {
                  
$msg_month[$month_key] = 0;
                  
/* $msg_size[$month_key] = 0.0; */
          
}
          
$msg_month[$month_key] += 1;
          
$msg_week[getweektodate($msg_date)] += 1;
          
$msg_week_size[getweektodate($msg_date)] += $size;
          
$msg_size[$month_key] += $size;

  }
}
foreach (
$msg_month as $key => $mon ){
        
$size $msg_size[$key]/1e6;
        
$total_size += $size;
        
printf ("Month %s has an email count of         %5d     (%5.1f MB)\n",$key$mon$size);
}
foreach ( 
$msg_week as $key => $num ) {
   
printf "Week[-%d] has an email count of    %5d     (%5.1f MB)\n",$key,$num,$msg_week_size[$key]/1e6);
}
printf ("Total mail box size = %5.1f MB\n",$total_size);
unset (
$key,$mon);
$time_elapsed time() - $start_time;
printf("Maximum email size  = %5.1f MB\n",$max_msg_size/1e6);
printf("Earliest email date = %s (%d days ago)\n",date('m/d/Y'$earliest_date),($tdate[0]-$earliest_date)/60/60/24)
;
print (
"Elapsed time = $time_elapsed seconds\n");
imap_close($mbox);
if (
$php_out)
   print 
"";

function 
getdaystodate($indate) {
  return (
$tdate[0]-$indate)/60/60/24;
}
function 
getweektodate($indate) {
  global 
$today;
  
/* echo  "Indate= $indate, today = $today\n";  */
  
return ((int) ($today-$indate)/60/60/24/7);
}
?>





http://en.wikipedia.org/wiki/Mbox
http://www.jwz.org/hacks/mork.pl

Compter le nombre des emails dans un dossier Thunderbird :
time grep '^From .*' ./.thunderbird/mmstrd1b.default/ImapMail?/imap.gmail.com/0\ Personnel -c

#!/usr/bin/perl


###########################################################################
# mailstat version 0.0.1 du 
# Développé par Charles Népote. charles@nepote.org
# http://www.nepote.org/charles/ged_conv/
# ged_conv est un logiciel libre sous licence GPL v.2.0.
#
# Ce script converti un fichier Gedcom généré par WinFam IV afin
# d'en corriger les erreurs.
#
###########################################################################
# Pour fonctionner, ce script nécessite que Perl soit installé.
# (cf. http://www.cpan.org/)
#
###########################################################################
# usage :
# c:\chemin>mailstat fichier_a_analyser
#
###########################################################################


$nom_du_script = "mailstat";
$version_du_script = "version 0.0.1";
$invite = "c:\\chemin>";

use LWP::Simple;
my $url = 'http://rn7.net/';
my $content = get $url;
die "Couldn't get $url" unless defined $content;


###########################################################################
# Affiche dans le shell les informations d'usage et teste si un
# argument a bien été entré (ie : le nom du fichier à convertir)
#
print STDOUT "\n\n";
print STDOUT "=" x 50;
print STDOUT "\n";
print STDOUT "$nom_du_script $version_du_script : analyse de boite mail\n";
print STDOUT "par Charles Nepote <charles\@nepote.org>\n";
print STDOUT "=" x 50;
print STDOUT "\n";
if (not $ARGV[0]) {
	print STDOUT "ERREUR ! Il faut specifier un fichier a analyser !\n";
	print STDOUT "Usage :\n$invite" . "$nom_du_script fichier_a_analyser\n\n\n";
	exit; }

###########################################################################
# Déclarations avant traitements
#
my $div = "";
my $compteur_ligne ="0";
my $mail = "0";


###########################################################################
# Traitements
#
# Ouverture du fichier source passé en argument
# A faire : gérer le cas où les fichiers ne s'ouvrent pas
#

open (SOURCE,$ARGV[0]);
print STDOUT "\nFichier ouvert ...\n";

#open (LOG_DATE,">log.date.gedconv.txt"); open (LOG_LIEUX,">log.lieux.gedconv.txt");
#open (LOG_EST,">log.date.est.gedconv.txt");


# Lit le fichier source ligne à ligne tant qu'on est pas arrivé à la dernière ligne
#
$/ = "\n";
while (<SOURCE>) {
	if ($_ =~ /^From .*/) { $mail = $mail + 1; }
	$compteur_lignes = $compteur_lignes + 1;
	#&traitement_ligne;
	#if($ARGV[1] eq "-ged55") { &lieux; }
	#&indentation;
	}
close (SOURCE);
#close (LOG_DATE); close (LOG_LIEUX); close(LOG_EST);


###########################################################################
# Présente un petit bilan statistique de la conversion
#
print STDOUT "\n------------------\n";
print STDOUT "$compteur_lignes lignes\n";
print STDOUT "$mail mails\n";

print STDOUT "------------------\n";
print "Fin du traitement.\n\n";



###########################################################################
# Fonction traitement_ligne
#
sub traitement_ligne {


	###################################################################
	# Compte 
	#
}

__END__


###########################################################################
# TODO :
# -- afficher le temps de traitement à la fin
# -- afficher la progression ?
#
###########################################################################
# Historique des versions
###########################################################################
# 0.0.1 : première version de développement (version jamais publiée).
# -- analyser un fichier au format mbox et rapporte le nombre de lignes et de mails
###########################################################################

Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]