This commit is contained in:
Nick Bebout 2011-07-11 16:24:12 -05:00
parent 091ae4a2e5
commit 90be463820
55 changed files with 16508 additions and 129 deletions

View file

@ -1,5 +1,5 @@
#!/bin/cat
# $Id: CREDITS,v 1.159 2011/05/30 21:58:46 gilles Exp gilles $
# $Id: CREDITS,v 1.160 2011/07/11 01:30:09 gilles Exp gilles $
If you want to make a donation to the author, Gilles LAMIRAL,
use any of the following ways:
@ -30,6 +30,13 @@ I thank very much all of these people.
I thank also very much all people who bought imapsync from the homepage
but I don't cite them here.
Paulo Victor Fernandes da Silva
Contributed by giving money 1 USD
Daniel Rohde
Bugfix. Solaris 10. ps -o vsz -p @PID
Dex Kelson.
Contributed by his patch for a better good_date() with --idatefromheader over 100000 messages.

View file

@ -1,17 +1,42 @@
RCS file: RCS/imapsync,v
Working file: imapsync
head: 1.446
head: 1.452
branch:
locks: strict
gilles: 1.446
gilles: 1.452
access list:
symbolic names:
keyword substitution: kv
total revisions: 446; selected revisions: 446
total revisions: 452; selected revisions: 452
description:
----------------------------
revision 1.446 locked by: gilles;
revision 1.452 locked by: gilles;
date: 2011/07/11 00:29:06; author: gilles; state: Exp; lines: +64 -47
Added the --search option allowing to select messages with the powerful IMAP SEARCH command.
----------------------------
revision 1.451
date: 2011/06/30 11:44:38; author: gilles; state: Exp; lines: +7 -8
Added IO::Socket::INET version info.
----------------------------
revision 1.450
date: 2011/06/21 00:17:20; author: gilles; state: Exp; lines: +7 -7
Bugfix. Fixed ps call to work with Solaris 10. Thanks to Daniel Rohde.
----------------------------
revision 1.449
date: 2011/06/16 12:20:42; author: gilles; state: Exp; lines: +13 -10
Kerio 7.2.0P1 success.
MDaemon 12.0.3 success.
----------------------------
revision 1.448
date: 2011/06/03 00:54:15; author: gilles; state: Exp; lines: +9 -9
Bugfix. Date reference to select messages with --maxdate --mindate is the beginning of imapsync run now.
----------------------------
revision 1.447
date: 2011/06/02 00:01:01; author: gilles; state: Exp; lines: +13 -13
Added PERMANENTFLAGS output with --debugflags
----------------------------
revision 1.446
date: 2011/05/31 09:11:18; author: gilles; state: Exp; lines: +17 -17
Bugfix. Try to handle Markus bug in foldersizes() when select_msgs() returns a list of undef.
----------------------------

21
FAQ
View file

@ -1,5 +1,5 @@
#!/bin/cat
# $Id: FAQ,v 1.88 2011/05/26 00:53:26 gilles Exp gilles $
# $Id: FAQ,v 1.89 2011/07/11 01:17:39 gilles Exp gilles $
+------------------+
| FAQ for imapsync |
@ -285,6 +285,25 @@ the backslash character \
(see next question to find a solution to this issue)
=======================================================================
Q. How to convert flags?
R. use --regexflag
For example to convert flag IMPORTANT to flag CANWAIT
imapsync ... --regexflag 's/IMPORTANT/CANWAIT/g' --debugflags
option --debugflags is usefull to see in details what imapsync
does with flags.
=======================================================================
Q. How to convert flags with $ to \ character?
R. $ and \ are special characters we have to "escape" them.
For example to convert flag $label1 to \label1
imapsync ... --regexflag 's/\$label1/\\label1/g' --debugflags
=======================================================================
Q. I need to keep only a defind list of flags, how can I do?
The destination imap server complains about bad flags (Exchange).

View file

@ -1,5 +1,5 @@
# $Id: Makefile,v 1.79 2011/05/31 21:32:16 gilles Exp gilles $
# $Id: Makefile,v 1.82 2011/07/11 01:02:45 gilles Exp gilles $
.PHONY: help usage all
@ -152,7 +152,7 @@ test_imapsync_exe: dosify_bat
time ssh Admin@c 'C:/msys/1.0/home/Admin/imapsync/test_exe.bat'
imapsync.exe: imapsync build_exe.bat test_exe.bat .dosify_bat
imapsync.exe: imapsync build_exe.bat .dosify_bat
rcsdiff imapsync
ssh Admin@c 'perl -V'
(date "+%s"| tr "\n" " "; echo -n "BEGIN " $(VERSION) ": "; date) >> .BUILD_EXE_TIME
@ -223,6 +223,8 @@ lalala:
dist_prepa: tarball dist_dir
ln -f ../prepa_dist/$(DIST_FILE) $(DIST_PATH)/
rcsdiff imapsync
cp -a imapsync $(DIST_PATH)/
#cd $(DIST_PATH)/ && md5sum $(DIST_FILE) > $(DIST_FILE).md5.txt
#cd $(DIST_PATH)/ && md5sum -c $(DIST_FILE).md5.txt
ls -l $(DIST_PATH)/
@ -244,36 +246,35 @@ dist_prepa_exe: imapsync.exe
ks:
rsync -avz --delete . imapsync@ks.lamiral.info:public_html/imapsync
{ cd /g/var/paypal_reply/ &&\
rsync -av url_exe url_release url_source imapsync@ks.lamiral.info:/g/var/paypal_reply/ \
; }
rsync -avz --delete --exclude imapsync.exe \
. imapsync@ks.lamiral.info:public_html/imapsync/
PUBLIC_FILES = ./ChangeLog ./COPYING ./CREDITS ./FAQ \
./index.shtml ./INSTALL ./TIME \
./logo_imapsync.png ./logo_imapsync_s.png \
./paypal.shtml ./paypal_return.shtml ./paypal_return_support.shtml \
./README ./style.css ./TODO ./VERSION ./VERSION_EXE
./README ./style.css ./TODO ./VERSION ./VERSION_EXE ./memo
upload_ks:
rsync -lptvHz $(PUBLIC_FILES) \
rsync -lptvHzP $(PUBLIC_FILES) \
root@ks.lamiral.info:/var/www/imapsync/
rsync -lptvHzr ./dist/ \
rsync -lptvHzrP ./dist/ \
root@ks.lamiral.info:/var/www/imapsync/dist/
upload_lfo:
#rm -rf /home/gilles/public_html/www.linux-france.org/html/prj/imapsync/
#rm -rf /home/gilles/public_html/www.linux-france.org/ftp/prj/imapsync/
rsync -avH $(PUBLIC_FILES) \
rsync -avHz $(PUBLIC_FILES) \
/home/gilles/public_html/www.linux-france.org/html/prj/imapsync/
rsync -avH ./dist/index.shtml \
/home/gilles/public_html/www.linux-france.org/html/prj/imapsync/dist/
rsync -lptvHzP ./lfo.htaccess \
/home/gilles/public_html/www.linux-france.org/html/prj/imapsync/.htaccess
sh ~/memo/lfo-rsync
upload_index: index.shtml
validate --verbose index.shtml
rcsdiff index.shtml
rsync -avH index.shtml root@ks.lamiral.info:/var/www/imapsync/
rsync -avH index.shtml \
../../public_html/www.linux-france.org/html/prj/imapsync/
sh $(HOME)/memo/lfo-rsync

12
README
View file

@ -3,7 +3,7 @@ NAME
Synchronise mailboxes between two imap servers. Good at IMAP migration.
More than 36 different IMAP server softwares supported with success.
$Revision: 1.446 $
$Revision: 1.452 $
SYNOPSIS
To synchronise imap account "foo" on "imap.truc.org" to imap account
@ -294,7 +294,7 @@ IMAP SERVERS
Patient and confident testers are welcome.
- Imail 7.04 (maybe).
Success stories reported with the following 41 imap servers (software
Success stories reported with the following 44 imap servers (software
names are in alphabetic order):
- 1und1 H mimap1 84498 [host1]
@ -331,8 +331,10 @@ IMAP SERVERS
- hMailServer 5.3.3 [host2], 4.4.1 [host1] (see FAQ)
- iPlanet Messaging server 4.15, 5.1, 5.2
- IMail 7.15 (Ipswitch/Win2003), 8.12, 11.03 [host1]
- Kerio 7.2.0P1 [host1]
- MailEnable 4.23 [host1] [host2]
- MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform), 12 [host2]
- MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform), 12 [host2],
12.0.3 [host1]
- Mercury 4.1 (Windows server 2000 platform)
- Microsoft Exchange Server 5.5, 6.0.6249.0[host1], 6.0.6487.0[host1],
6.5.7638.1 [host2], 6.5 [host1], Exchange 2007 SP1 (with Update Rollup 2),
@ -357,7 +359,7 @@ IMAP SERVERS
(RedHat uses UW like 2003.338rh), v12.264 Solaris 5.7 (OSI Approved)
(http://www.washington.edu/imap/)
- UW - QMail v2.1
- Imap part of TCP/IP suite of VMS 7.3.2
- VMS, Imap part of TCP/IP suite of VMS 7.3.2
- Zimbra-IMAP 3.0.1 GA 160, 3.1.0 Build 279, 4.0.5, 4.5.2, 4.5.6,
Zimbra 5.0.24_GA_3356.RHEL4 [host1], 5.5, 6.x
@ -424,5 +426,5 @@ SIMILAR SOFTWARES
Feedback (good or bad) will often be welcome.
$Id: imapsync,v 1.446 2011/05/31 09:11:18 gilles Exp gilles $
$Id: imapsync,v 1.452 2011/07/11 00:29:06 gilles Exp gilles $

2
TIME
View file

@ -1,3 +1,5 @@
60 Added --search option.
600 (1.446) new host ks. newsletter for imapsync updates. first letter to 563 members.
30 Patched tests_good_date() and good_date() with Dax Kelson patches.
120 Added a good reply for buying support.
540 (1.434) (1.433) (1.432)

6
TODO
View file

@ -1,5 +1,5 @@
#!/bin/cat
# $Id: TODO,v 1.98 2011/05/30 21:59:06 gilles Exp gilles $
# $Id: TODO,v 1.100 2011/07/11 01:09:39 gilles Exp gilles $
TODO file for imapsync
----------------------
@ -25,6 +25,8 @@ http://www.yippiemove.com/
Find a way to avoid passwords in --debugimap unless needed.
Explain that users can win time/bandwidth by using --expunge
Fix long path over than 256 character on Win32.
Think about Digest::SHA or Digest::SHA::PurePerl.
@ -158,6 +160,8 @@ http://asg.web.cmu.edu/cyrus/download/imapd/altnamespace.html
===========================================================================
DONE. Add --search option allowing to select messages with any IMAP SEARCH command.
DONE. Make --usecache works with --maxage --maxsize etc.
DONE. Fix Exchange 2010 SP1 issue with --foldersizes when

View file

@ -1 +1 @@
1.446
1.452

View file

@ -1 +1 @@
1.446
1.452

26
W/CONCEPTION Normal file
View file

@ -0,0 +1,26 @@
===== Synopsis =====
$mailbox_1 = Mail::imapsync::mailbox->new();
$mailbox_2 = Mail::imapsync::mailbox->new();
$mailbox_1->host('imap1.lala.org');
$mailbox_1->user('toto1');
...
$mailbox_2->host('imap2.lala.org');
$mailbox_2->user('toto2');
...
$transfer = Mail::imapsync::transfer->new();
$transfer->sync($mailbox_1, $mailbox_2);
- an object for mailbox
- an object for a transfer
- ?an object for a folder?
- ?an object for a message?

46
W/RECORD Normal file
View file

@ -0,0 +1,46 @@
+------------------+
| imapsync records |
+------------------+
You can add your own record if you want.
Here is a template.
-------------------------------------------------------------------------------
Your Name/Compagny :
Time to migrate :
Number of mailboxes :
Total size :
Comment :
-------------------------------------------------------------------------------
Your Name/Compagny : Thomas Hallock/Medicus Insurance Company
Time to migrate : The initial sync took about 15 hours. We mirrored the
"from" and "to" mailboxes via cron for a couple of weeks during the
transition. Each day after the initial sync, the script would run for
about 3 hours to catch up with the day-to-day changes. Our mail
server is a Dual-Core Intel Xeon XServe.
Number of mailboxes : 25
Total size : 40+ GB
Comment : It worked flawlessly,
and was even able to address issues I wouldn't have expected it
could, such as synchronizing deletions, and handling differing IMAP
path prefixes between the to and from servers.
-------------------------------------------------------------------------------
Your Name/Compagny : Olivier Morel
Time to migrate : 18 hours
Number of mailboxes : 2200
Total size : 18 Go
Comment : Nous avons terminé notre migration et récupéré l'ensemble
des boites aux lettres grace à votre outil, tout s'est
déroulé à merveille.
-------------------------------------------------------------------------------
Your Name/Compagny : anonymous
Time to migrate : ?
Number of mailboxes : ~10000 mailboxes
Total size : ~70Gb of data
Comment : from Rockliffe Mailsite 4.5 to Courier 4.1.1.20060828-5.

6
W/adwords Normal file
View file

@ -0,0 +1,6 @@
IMAP migration tool
Buy imapsync.exe + source for 30 €
30 days money-back guarantee
linux-france.org/prj/imapsync/
www.linux-france.org/prj/imapsync/

10
W/freshmeat/freshmeat Normal file
View file

@ -0,0 +1,10 @@
http://freshmeat.net/projects/imapsync/
imapsync is a tool for facilitating incremental recursive IMAP
transfers from one mailbox to another. It is useful for mailbox
migration, and reduces the amount of data transferred by only copying
messages that are not present on both servers. Read, unread, and
deleted flags are preserved, and the process can be stopped and
resumed. The original messages can optionally be deleted after a
successful transfer.

View file

@ -0,0 +1,15 @@
#
#RELEASE_FOCUS="Initial freshmeat announcement"
#RELEASE_FOCUS="Documentation"
#RELEASE_FOCUS="Code cleanup"
RELEASE_FOCUS="Minor feature enhancements"
#RELEASE_FOCUS="Major feature enhancements"
#RELEASE_FOCUS="Minor bugfixes"
#RELEASE_FOCUS="Major bugfixes"
#RELEASE_FOCUS="Minor security fixes"
#RELEASE_FOCUS="Major security fixes"
#TEXT_BODY="Syntax cleanup"
#TEXT_BODY="Updated documentation"
TEXT_BODY="Several improvements to reach better usability. Authentication cram-md5 is not used by default (too few server support it). Issues from servers changing or adding header are avoided. Now imapsync has a way to handle efficiently no header in messages. The imap server dkimap is supported (dkimap isn't a uid capability server). Added NTLM authentication with domain. Added --minsize option to transfer messages bigger than a given size. Added memory consumption measurement to compute how much concurrent imapsync can run in parallel on a system. Imapsync is no longer gratis from the home page."

View file

@ -0,0 +1,9 @@
{
"release": {
"tag_list": "stable, Minor feature enhancements",
"version": "1.383",
"hidden_from_frontpage": false,
"changelog": "Since last public release 1.350 several improvements have been made to reach a better usability. By default, authentication cram-md5 is not used (too few server support it) so --noauthmd5 option becomes useless. To avoid issues from servers changing or adding header option --useheader Message-Id is on by default too. Now imapsync has a way to handle efficiently no headers in messages (take first 2KB body). The imap server dkimap is now supported (it was not because dkimap is not a uid capability server). NTLM authentication with domain is supported. Added --minsize option to transfer messages bigger than a given size. Added memory consumption measurement to compute how much concurrent imapsync can run in parallel on a system. Imapsync is no longer gratis from the home page. Imapsync license has not changed, it is still a WTFPL software. Thanks again to the freshmeat guy who corrects my bad and poorly English!"
}
}

View file

@ -0,0 +1,12 @@
Project: imapsync
Version: 1.293
Release-Focus: Minor bugfixes
Hide: N
Home-Page-URL: http://www.linux-france.org/prj/imapsync/
Gzipped-Tar-URL: http://www.linux-france.org/prj/imapsync/dist/
Bug fixes.
Many thanks to the freshmeat folk that correct my bad and poorly English !

16
W/lsm.imapsync Normal file
View file

@ -0,0 +1,16 @@
Begin4
Title: imapsync
Version: 1.209
Entered-date: 2007-01-09
Description: IMAP synchronisation, sync, copy or migration tool.
Synchronise mailboxes between two imap servers. Good at IMAP migration.
More than 32 different IMAP server softwares supported with success.
Keywords: IMAP synchronisation mail
Author: lamiral@linux-france.org (Gilles LAMIRAL)
Maintained-by: lamiral@linux-france.org (Gilles LAMIRAL)
Primary-site: http://www.linux-france.org/prj/imapsync/dist/
Alternate-site:
Original-site: http://www.linux-france.org/prj/imapsync/dist/
Platforms: UNIX Windows
Copying-policy: GPL
End

13
W/paypal_reply/8859_utf8 Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/perl -w
# $Id: 8859_utf8,v 1.1 2010/10/01 13:00:09 gilles Exp gilles $
use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset);
die unless (utf8_supported_charset('ISO-8859-1'));
while (<>) {
print to_utf8({ -string => $_, -charset => 'ISO-8859-1' });
}

6
W/paypal_reply/TODO Normal file
View file

@ -0,0 +1,6 @@
Rewrite all with less scripts
use Email::Simple module

293
W/paypal_reply/memo Normal file
View file

@ -0,0 +1,293 @@
#!/bin/sh
# $Id: memo,v 1.5 2011/05/20 12:57:31 gilles Exp gilles $
echo paypal_bilan_tests_refact_4
paypal_bilan_tests_refact_4() {
# DID output no diff between paypal_bilan_1.33 and 1.??
(
#set -x
# from 147 to 213
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 --bnc --debug --first_in 147 /g/paypal/paypal_2010_11_complet.csv > /g/var/paypal_bilan/tests/paypal_2010_11_complet.csv.1.33_first_in.out1
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 147 /g/paypal/paypal_2010_11_complet.csv > /g/var/paypal_bilan/tests/paypal_2010_11_complet.csv.1.33_first_in.out2
echo diff /g/var/paypal_bilan/tests/paypal_2010_11_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2010_11_complet.csv.1.33_first_in.out2
diff /g/var/paypal_bilan/tests/paypal_2010_11_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2010_11_complet.csv.1.33_first_in.out2
# from 214 to 291
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 --bnc --debug --first_in 214 /g/paypal/paypal_2010_12_complet.csv > /g/var/paypal_bilan/tests/paypal_2010_12_complet.csv.1.33_first_in.out1
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 214 /g/paypal/paypal_2010_12_complet.csv > /g/var/paypal_bilan/tests/paypal_2010_12_complet.csv.1.33_first_in.out2
echo diff /g/var/paypal_bilan/tests/paypal_2010_12_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2010_12_complet.csv.1.33_first_in.out2
diff /g/var/paypal_bilan/tests/paypal_2010_12_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2010_12_complet.csv.1.33_first_in.out2
# from 294 to 381
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 --bnc --debug --first_in 294 /g/paypal/paypal_2011_01_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out1
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 294 /g/paypal/paypal_2011_01_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out2
echo diff /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out2
diff /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out2
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 292 --avoid_numbers '292 293' /g/paypal/paypal_2011_01_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out3
echo diff /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out3
diff /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_01_complet.csv.1.33_first_in.out3
# from 382 to 472
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 --bnc --debug --first_in 382 /g/paypal/paypal_2011_02_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_02_complet.csv.1.33_first_in.out1
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 382 /g/paypal/paypal_2011_02_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_02_complet.csv.1.33_first_in.out2
echo diff /g/var/paypal_bilan/tests/paypal_2011_02_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_02_complet.csv.1.33_first_in.out2
diff /g/var/paypal_bilan/tests/paypal_2011_02_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_02_complet.csv.1.33_first_in.out2
# from 473 to 569
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 --bnc --debug --first_in 473 /g/paypal/paypal_2011_03_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_03_complet.csv.1.33_first_in.out1
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 473 /g/paypal/paypal_2011_03_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_03_complet.csv.1.33_first_in.out2
echo diff /g/var/paypal_bilan/tests/paypal_2011_03_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_03_complet.csv.1.33_first_in.out2
diff /g/var/paypal_bilan/tests/paypal_2011_03_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_03_complet.csv.1.33_first_in.out2
# from 570 to 642
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 --bnc --debug --first_in 570 /g/paypal/paypal_2011_04_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_04_complet.csv.1.33_first_in.out1
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 570 /g/paypal/paypal_2011_04_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_04_complet.csv.1.33_first_in.out2
echo diff /g/var/paypal_bilan/tests/paypal_2011_04_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_04_complet.csv.1.33_first_in.out2
diff /g/var/paypal_bilan/tests/paypal_2011_04_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_04_complet.csv.1.33_first_in.out2
# from 645 to 730
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 --bnc --debug --first_in 645 /g/paypal/paypal_2011_05_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_05_complet.csv.1.33_first_in.out1
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 645 /g/paypal/paypal_2011_05_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_05_complet.csv.1.33_first_in.out2
echo diff /g/var/paypal_bilan/tests/paypal_2011_05_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_05_complet.csv.1.33_first_in.out2
diff /g/var/paypal_bilan/tests/paypal_2011_05_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_05_complet.csv.1.33_first_in.out2
# from 733 to 764
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 --bnc --debug --first_in 733 /g/paypal/paypal_2011_06_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out1
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 733 /g/paypal/paypal_2011_06_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out2
echo diff /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out2
diff /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out2
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 733 --avoid_numbers '' \
/g/paypal/paypal_2011_06_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out3
echo diff /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out3
diff /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out3
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug --first_in 731 --avoid_numbers '731 732' \
/g/paypal/paypal_2011_06_complet.csv > /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out4
echo diff /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out4
diff /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out1 /g/var/paypal_bilan/tests/paypal_2011_06_complet.csv.1.33_first_in.out4
for f in /g/paypal/paypal_201?_??_complet.csv; do
fb=`basename "$f"`
f1=/g/var/paypal_bilan/tests/${fb}_1.32.out1
f2=/g/var/paypal_bilan/tests/${fb}_1.32.out2
rm "$f2"
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 \
--bnc --debug --debug_csv "$f" \
> "$f1"
/g/public_html/imapsync/W/paypal_reply/paypal_bilan \
--bnc --debug --debug_csv "$f" \
> "$f2"
echo diff "$f1" "$f2"
diff "$f1" "$f2"
done
for f in /g/paypal/paypal_201?_??_complet.csv; do
fb=`basename "$f"`
f1=/g/var/paypal_bilan/tests/${fb}_tva.out1
f2=/g/var/paypal_bilan/tests/${fb}_tva.out2
rm "$f2"
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.33 \
"$f" \
> "$f1"
/g/public_html/imapsync/W/paypal_reply/paypal_bilan \
"$f" \
> "$f2"
echo diff "$f1" "$f2"
diff "$f1" "$f2"
done
)
}
#echo paypal_bilan_tests_refact_3
paypal_bilan_tests_refact_3() {
# DID output no diff between paypal_bilan_1.27 and 1.??
(
#set -x
for f in /g/paypal/paypal_201?_??_complet.csv; do
fb=`basename "$f"`
f1=/g/var/paypal_bilan/tests/${fb}_1.27.out1
f2=/g/var/paypal_bilan/tests/${fb}_1.27.out2
rm "$f2"
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.27 \
--bnc --debug --debug_csv "$f" \
> "$f1"
/g/public_html/imapsync/W/paypal_reply/paypal_bilan \
--bnc --debug --debug_csv "$f" \
> "$f2"
echo diff "$f1" "$f2"
diff "$f1" "$f2"
done
for f in /g/paypal/paypal_201?_??_complet.csv; do
fb=`basename "$f"`
f1=/g/var/paypal_bilan/tests/${fb}_tva.out1
f2=/g/var/paypal_bilan/tests/${fb}_tva.out2
rm "$f2"
/g/public_html/imapsync/W/paypal_reply/paypal_bilan_1.27 \
"$f" \
> "$f1"
/g/public_html/imapsync/W/paypal_reply/paypal_bilan \
"$f" \
> "$f2"
echo diff "$f1" "$f2"
diff "$f1" "$f2"
done
)
}
#echo paypal_bilan_tests_refact_2
paypal_bilan_tests_refact_2() {
# DID output no diff between paypal_bilan_1.22 and 1.23
(
set -x
for f in /g/paypal/paypal_201?_??_complet.csv; do
fb=`basename "$f"`
f1=/g/var/paypal_bilan/tests/${fb}_1.22.out1
f2=/g/var/paypal_bilan/tests/${fb}_1.22.out2
rm "$f2"
/g/public_html/imapsync/paypal_reply/paypal_bilan_1.22 \
--bnc --debug --debug_csv "$f" \
> "$f1"
/g/public_html/imapsync/paypal_reply/paypal_bilan \
--bnc --debug --debug_csv "$f" \
> "$f2"
echo diff "$f1" "$f2"
diff "$f1" "$f2"
done
for f in /g/paypal/paypal_201?_??_complet.csv; do
fb=`basename "$f"`
f1=/g/var/paypal_bilan/tests/${fb}_tva.out1
f2=/g/var/paypal_bilan/tests/${fb}_tva.out2
rm "$f2"
/g/public_html/imapsync/paypal_reply/paypal_bilan_1.22 \
"$f" \
> "$f1"
/g/public_html/imapsync/paypal_reply/paypal_bilan \
"$f" \
> "$f2"
echo diff "$f1" "$f2"
diff "$f1" "$f2"
done
)
}
#echo paypal_bilan_tests_refact_1
paypal_bilan_tests_refact_1() {
# DID output no diff between paypal_bilan_1.11 and 1.13
(
#set -x
for f in /g/paypal/paypal_201?_??.csv; do
fb=`basename "$f"`
f1=/g/var/paypal_bilan/tests/$fb.out1
f2=/g/var/paypal_bilan/tests/$fb.out2
rm "$f2"
/g/public_html/imapsync/paypal_reply/paypal_bilan_1.11 \
--bnc --debug "$f" \
> "$f1"
/g/public_html/imapsync/paypal_reply/paypal_bilan \
--bnc --debug "$f" \
> "$f2"
echo diff "$f1" "$f2"
diff "$f1" "$f2"
done
for f in /g/paypal/paypal_201?_??.csv; do
fb=`basename "$f"`
f1=/g/var/paypal_bilan/tests/$fb.out1
f2=/g/var/paypal_bilan/tests/$fb.out2_usd_eur
rm "$f2"
/g/public_html/imapsync/paypal_reply/paypal_bilan_1.11 \
--bnc --debug "$f" \
> "$f1"
/g/public_html/imapsync/paypal_reply/paypal_bilan \
--bnc --debug --usdeur 1.2981 "$f" \
> "$f2"
echo diff "$f1" "$f2"
diff "$f1" "$f2"
done
for f in /g/paypal/paypal_201?_??.csv; do
fb=`basename "$f" .csv`
#echo $fb
f1i=/g/paypal/$fb.csv
f2i=/g/paypal/${fb}_complet.csv
f1o=/g/var/paypal_bilan/tests/t03_$fb.out1
f2o=/g/var/paypal_bilan/tests/t03_$fb.out2
#echo $f1i
#echo $f2i
#echo $f1o
#echo $f2o
rm -f "$f1o" "$f2o"
/g/public_html/imapsync/paypal_reply/paypal_bilan \
--bnc --debug "$f1i" \
> "$f1o"
/g/public_html/imapsync/paypal_reply/paypal_bilan \
--bnc --debug "$f2i" \
> "$f2o"
echo diff "$f1o" "$f2o"
diff "$f1o" "$f2o"
done
)
}
#echo paypal_bilan_tests_dev
paypal_bilan_tests_dev() {
/g/public_html/imapsync/paypal_reply/paypal_bilan \
/g/paypal/paypal_201?_??_complet.csv --invoices '1 50 200'
# Strange characters
/g/public_html/imapsync/paypal_reply/paypal_bilan \
/g/paypal/paypal_201?_??_complet.csv --invoices '389 234 96'
# France
/g/public_html/imapsync/paypal_reply/paypal_bilan \
/g/paypal/paypal_201?_??_complet.csv --invoices '9 392'
# individual
/g/public_html/imapsync/paypal_reply/paypal_bilan \
/g/paypal/paypal_201?_??_complet.csv --invoices '313 415'
# /g/public_html/imapsync/paypal_reply/paypal_bilan /g/paypal/paypal_2011_03_complet.csv
# pb with latex
# Ok 10 # character
# 65 clientAdrB Keyboard character used is undefined YOSHITO YONEI
# Ok 84 Missing $ inserted. clientEmail victor_su@yahoo.com
# 92 Dr. Westernacher & Partner GmbH
# /g/public_html/imapsync/paypal_reply/paypal_bilan --first_in 147 --invoices '242' /g/paypal/paypal_2010_1?_complet.csv
}

1073
W/paypal_reply/paypal_bilan Executable file

File diff suppressed because it is too large Load diff

756
W/paypal_reply/paypal_bilan_1.22 Executable file
View file

@ -0,0 +1,756 @@
#!/usr/bin/perl
# $Id: paypal_bilan,v 1.22 2011/04/19 12:52:27 gilles Exp $
use strict;
use warnings;
use Getopt::Long;
use Text::CSV_XS ;
use IO::Handle ;
use Data::Dumper ;
use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset);
die unless (utf8_supported_charset('ISO-8859-1'));
my $total_usd_received = 0 ;
my $total_usd_invoice = 0 ;
my $total_eur_received = 0 ;
my $total_eur_invoice = 0 ;
my $nb_invoice = 0 ;
my $nb_invoice_refund = 0 ;
my $debug ;
my $debug_csv ;
my $debug_dev ;
my $first_invoice = 1 ;
my $print_details = '' ;
my $bnc = '';
my $usdeur = 1.2981 ;
my $invoices ;
my %invoice_refund ;
my $write_invoices = 0;
my $dir_invoices = '/g/var/paypal_invoices' ;
my $option_ret = GetOptions (
'debug' => \$debug,
'debug_csv' => \$debug_csv,
'debug_dev' => \$debug_dev,
'first_invoice=i' => \$first_invoice,
'print_details|details' => \$print_details,
'bnc' => \$bnc,
'usdeur=f' => \$usdeur,
'invoices=s' => \$invoices,
'write_invoices!' => \$write_invoices,
);
my @files = @ARGV ;
my %action_of_invoice ;
my @invoices = split( /\s+/, $invoices ) if $invoices ;
#print "@invoices\n" ;
foreach my $file ( @files ) {
my @actions = parse_file( $file ) ;
foreach my $action (@actions) {
my %action = %$action ;
#print $action->{ Nom }, "\n" ;
my( $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat,
$Devise, $Montant, $Numero_davis_de_reception, $Solde,
$Pays, $Nom_Option_1, $Valeur_Option_1, $Hors_taxe )
= @action{ ( 'Date', 'Heure', 'Fuseau horaire', 'Nom', 'Type', 'Etat',
'Devise', 'Montant', "Numéro d'avis de réception", 'Solde',
'Pays', 'Nom Option 1', 'Valeur Option 1', 'Hors taxe') } ;
#print "$Nom\n" ;
my $invoice = 'NONE' ;
$Montant = $action->{ Net } if not defined $Montant;
compute_line($action, $invoice, $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat,
$Devise, $Montant, $Numero_davis_de_reception, $Solde,
$Pays, $Nom_Option_1, $Valeur_Option_1, $Hors_taxe ) ;
# index by invoice number
$action_of_invoice{ $action->{ 'invoice' } } = $action ;
}
delete $action_of_invoice{ 'NONE' } ;
}
@invoices = ( $first_invoice .. $first_invoice + $nb_invoice -1 ) if ( ! @invoices ) ;
foreach my $invoice ( @invoices ) {
build_invoice( $invoice ) ;
}
print "USD banque $total_usd_received\n" ;
print "USD invoice $total_usd_invoice\n" ;
my $total_eur_from_usd ;
$total_eur_from_usd = int( ( $total_usd_invoice / $usdeur ) + 0.5 ) ; # au 30 nov 2010 http://fr.finance.yahoo.com/devises/convertisseur/#from=EUR;to=USD;amt=1
print "EUR from USD $total_eur_from_usd\n" ;
#$total_eur = int( ( $total_eur_invoice / 1.3 ) + 0.5 ) ;
#print "EUR $total_eur_from_usd\n" ;
print "EUR banque $total_eur_received\n" ;
print "EUR invoice $total_eur_invoice\n" ;
my $total_eur = $total_eur_from_usd + $total_eur_invoice ;
print "EUR total $total_eur\n" ;
print "Nb invoice $nb_invoice\n" ;
print "Nb invoice refund $nb_invoice_refund\n" ;
sub parse_one_line_io {
my $csv = shift ;
my $io = shift ;
my $line = $csv->getline($io) ;
return if ( $csv->eof( ) ) ;
if ( not defined( $line ) ) {
my($cde, $str, $pos) = $csv->error_diag () ;
print "[$cde] [$str] [$pos]\n" ;
}
return( $line ) ;
}
sub hash_and_count_dupplicate {
my @columns = @_ ;
my %columns ;
#@columns_def{ @columns_def } = ( ) ;
foreach my $col ( @columns ) {
$columns{ $col } += 1 ;
}
$debug_csv and print "Nb columns: ", scalar( keys %columns ), " ", scalar( @columns ), "\n" ;
# debug how many time a title is defined
foreach my $col (1 .. scalar( @columns )) {
$debug_csv and print "$col | ",
deci_to_AA( $col ) , " | ",
$columns{ $columns[ $col - 1 ] }, " | ",
$columns[ $col - 1 ], "\n" ;
}
# exit in case two columns have the same name
die "Erreur : doublons dans les titres\n" if ( scalar( keys %columns ) != scalar( @columns ) ) ;
return( %columns ) ;
}
sub deci_to_AA {
my $deci = shift ;
my $AA = '';
while ( $deci > 0 ) {
my $quot = int( ( $deci - 1 ) / 26 ) ;
my $rest = $deci - 1 - ( 26 * $quot ) ;
my $char = chr ( ord('A') + $rest ) ;
$AA = $char . $AA ;
$deci = $quot ;
}
#print "col=$AA\n" ;
return( $AA ) ;
}
sub remove_first_blank {
my $string = shift ;
$string =~ s/^ +// ;
return( $string ) ;
}
sub parse_file {
my $file = shift ;
open my $io, "<", $file or die "$file: $!" ;
my $csv = Text::CSV_XS->new( {
sep_char => ',',
binary => 1,
keep_meta_info => 1,
eol => $/,
} ) ;
my $line_1 = parse_one_line_io( $csv, $io ) ;
die if ( not defined $line_1 ) ; # first line must have no problem
my @columns_def_orig = @$line_1 ;
my @columns_def = map { remove_first_blank( $_ ) } @columns_def_orig ;
$debug_csv and print "columns_def = ", map( { "[$_]" } @columns_def ), "\n";
my %columns_def = hash_and_count_dupplicate( @columns_def ) ;
my $nb_columns_def = scalar @columns_def ;
my $line_counter = 2 ;
my @actions ;
while ( 1 ) {
$debug_csv and print "ligne $line_counter ", $csv->eof( ), "\n" ;
my $line = parse_one_line_io( $csv, $io ) ;
last if ( $csv->eof( ) ) ;
if ( not defined $line ) {
print "Erreur ligne $line_counter : ", $csv->error_diag, "\n\n";
++$line_counter ;
next ;
}
my @columns = @$line ;
if ( $nb_columns_def != scalar @columns ) {
print "Erreur ligne $line_counter : nombre de colonnes = ", scalar @columns, " != $nb_columns_def\n" ;
++$line_counter ;
next ;
}
my %columns ;
@columns{ @columns_def } = @columns ;
$columns{ 'file_csv' } = $file ;
$columns{ 'line_number' } = $line_counter ;
$csv->combine( @columns ) ;
my $line_csv = $csv->string();
$columns{ 'line_csv' } = $line_csv ;
$debug_csv and print map( { "[$_] = [" . $columns{$_} . "]\n" }
@columns_def, 'line_number', 'line_csv', 'file_csv' ),
"\n";
++$line_counter ;
push( @actions, \%columns ) ;
}
close( $io );
return( reverse @actions ) ;
}
sub compute_line {
my( $action, $invoice, $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat,
$Devise, $Montant, $Numero_davis_de_reception, $Solde,
$Pays, $Nom_Option_1, $Valeur_Option_1, $Hors_taxe_paypal ) = @_ ;
$debug and print( "[$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n",
"[$Pays] [$Nom_Option_1] [$Valeur_Option_1]\n" ) ;
#$debug_dev and print "$Hors_taxe_paypal\n" ;
$Montant =~ s/[^0-9-,.]//g ;
$Montant =~ s/,/./g ;
#$debug and print "MM[$Montant]\n" ;
$Hors_taxe_paypal =~ s/,/./g ;
my $MontantEUR;
if ( $bnc ) {
$MontantEUR = $Montant ;
$MontantEUR = sprintf( "%.4f", $Montant/$usdeur ) if ($Devise eq 'USD') ;
print( "\n", "=" x 60, "\n" ) ;
print( "[$Date] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [EUR $MontantEUR]\n",
"[$Pays] [$Nom_Option_1] [$Valeur_Option_1]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'USD' eq $Devise
and 'Terminé' eq $Etat
) {
$Montant =~tr/,/./;
#print "$Montant\n" ;
my $Montant2_usd;
$Montant2_usd = $Hors_taxe_paypal ;
$total_usd_received += $Montant ;
$total_usd_invoice += $Montant2_usd ;
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'USD' eq $Devise
and 'Compensé' eq $Etat
) {
$Montant =~tr/,/./;
#print "$Montant\n" ;
my $Montant2_usd;
$Montant2_usd = $Hors_taxe_paypal ;
$total_usd_received += $Montant ;
$total_usd_invoice += $Montant2_usd ;
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Terminé' eq $Etat
) {
$Montant =~tr/,/./;
#print "$Montant\n" ;
my $Montant2_eur;
$Montant2_eur = $Hors_taxe_paypal ;
$total_eur_received += $Montant ;
$total_eur_invoice += $Montant2_eur ;
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Remboursé' eq $Etat
) {
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$nb_invoice_refund++;
$invoice_refund{ $invoice }++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Compensé' eq $Etat
) {
$Montant =~tr/,/./;
#print "$Montant\n" ;
my $Montant2_eur;
$Montant2_eur = 21.99 if ( 20.88 == $Montant or 20.99 == $Montant ) ;
$Montant2_eur = 30 if ( 28.58 == $Montant or 28.73 == $Montant ) ;
$Montant2_eur = 110 if ( 105.46 == $Montant ) ;
#print "$Montant $Montant2_eur\n" ;
$total_eur_received += $Montant ;
$total_eur_invoice += $Montant2_eur ;
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Non compensé' eq $Etat
) {
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
$action->{ 'invoice' } = $invoice ;
if ( $bnc ) {
my $FR_flag = '' ;
$FR_flag = ' FR' if $Pays eq 'France' ;
my $IND_flag = '' ;
$IND_flag = ' IND' if ('imapsync usage' eq $Nom_Option_1 and 'individual' eq $Valeur_Option_1 ) ;
print "FE $invoice$FR_flag$IND_flag\n" ;
print "Facture $invoice imapsync$FR_flag $Nom\n" ;
printf( "%.2f [EUR %.2f]\n", $Montant, $MontantEUR ) ;
}
}
sub build_invoice {
my $invoice = shift ;
return if ! $invoice ;
my $action = $action_of_invoice{ $invoice } ;
my $refund = '' ;
$refund = 'REFUND ' if $invoice_refund{ $invoice } ;
my %action = %$action if $action ;
#print Data::Dumper->Dump( [$action] ) ;
my( $Date, $Heure, $Nom, $Type, $Etat, $Devise, $Hors_taxe, $Commission, $Net,
$De_l_adresse_email, $A_l_adresse_email, $N_de_transaction, $Titre_de_l_objet,
$TVA, $Nom_Option_1, $Valeur_Option_1, $N_de_transaction_de_reference,
$Adresse_1, $Adresse_2_district_quartier, $Ville,
$Etat_Province, $Code_postal, $Pays, $line_number, $line_csv, $file_csv )
= @action{ ( 'Date', 'Heure', 'Nom', 'Type', 'Etat', 'Devise', 'Hors taxe', 'Commission', 'Net',
"De l'adresse email", "A l'adresse email", 'N° de transaction', "Titre de l'objet",
'TVA', 'Nom Option 1', 'Valeur Option 1', 'Nº de transaction de référence',
'Adresse 1', 'Adresse 2/district/quartier', 'Ville',
'Etat/Province/Région/Comté/Territoire/Préfecture/République', 'Code postal', 'Pays', 'line_number', 'line_csv', 'file_csv' ) } ;
#print "$Hors_taxe $Devise\n" ;
my $Hors_taxe_num = $Hors_taxe ;
$Hors_taxe_num =~ s{,}{.} ;
if ($Hors_taxe_num > 100) {
print "invoice $invoice $Hors_taxe_num > 100\n" ;
#return() ;
}
my ( $email_message_header, $email_message_body )
= build_email_message( $Date, $Nom, $De_l_adresse_email, $invoice ) ;
if ( $write_invoices ) {
write_email_message( $dir_invoices, $invoice,
$email_message_header, $email_message_body,
$De_l_adresse_email) ;
write_csv_info( $dir_invoices, $invoice, $file_csv, $line_number, $line_csv ) ;
}
#print "==== $invoice $refund=================================================" ;
#print $email_message ;
my(
$clientAdrA,
$clientAdrB,
$clientAdrC,
$clientAdrD,
$clientAdrE,
$clientAdrF,
)
= build_adress(
$Nom,
$Adresse_1,
$Adresse_2_district_quartier,
$Ville,
$Code_postal,
$Etat_Province,
$Pays,
) ;
foreach my $str (
$De_l_adresse_email,
$Nom,
$clientAdrA,
$clientAdrB,
$clientAdrC,
$clientAdrD,
$clientAdrE,
$clientAdrF,
) {
$str =~ s{#}{\\#}g ;
$str =~ s{_}{\\_}g ;
$str =~ s{&}{\\&}g ;
}
my ( $clientTypeEN, $clientTypeFR ) = client_type( $Nom_Option_1, $Valeur_Option_1 ) ;
my (
$priceHT,
$tvaFR,
$tvaEN,
$priceTVA,
$priceTTC,
$messageTVAFR,
$messageTVAEN,
$priceTTCusd
)
= tva_stuff( $clientTypeEN, $Pays, $Hors_taxe, $Devise ) ;
my ( $urlSrc, $urlExe ) = download_urls( $Date ) ;
my $tex_variables = qq{
%% Begin input from $0
\\providecommand{\\invoiceNumber}{$invoice}
\\providecommand{\\clientName}{$Nom}
\\providecommand{\\clientEmail}{$De_l_adresse_email}
\\providecommand{\\clientTypeEN}{$clientTypeEN}
\\providecommand{\\clientTypeFR}{$clientTypeFR}
\\providecommand{\\clientAdrA}{$clientAdrA}
\\providecommand{\\clientAdrB}{$clientAdrB}
\\providecommand{\\clientAdrC}{$clientAdrC}
\\providecommand{\\clientAdrD}{$clientAdrD}
\\providecommand{\\clientAdrE}{$clientAdrE}
\\providecommand{\\clientAdrF}{$clientAdrF}
\\providecommand{\\invoiceDate}{$Date}
\\providecommand{\\invoiceHour}{$Heure}
\\providecommand{\\priceHT}{$priceHT}
\\providecommand{\\tvaFR}{$tvaFR}
\\providecommand{\\tvaEN}{$tvaEN}
\\providecommand{\\priceTVA}{$priceTVA}
\\providecommand{\\priceTTC}{$priceTTC}
\\providecommand{\\priceTTCusd}{$priceTTCusd}
\\providecommand{\\messageTVAFR}{$messageTVAFR}
\\providecommand{\\messageTVAEN}{$messageTVAEN}
\\providecommand{\\urlSrc}{\\url{$urlSrc}}
\\providecommand{\\urlExe}{\\url{$urlExe}}
%% End input from $0
} ;
#print $tex_variables ;
write_tex_variables_file( $dir_invoices,
$invoice, $Date, $tex_variables ) if $write_invoices ;
}
sub build_email_message {
my ( $date, $name, $email, $invoice ) = @_ ;
my $message_header = qq{X-imapsync: invoice $invoice
From: Gilles LAMIRAL <gilles.lamiral\@laposte.net>
Bcc: gilles\@lamiral.info
Subject: [imapsync invoice] $invoice ($date)
Disposition-Notification-To: Gilles LAMIRAL <gilles.lamiral\@laposte.net>
} ;
my $message_body = qq{
Hello $name,
First I'm sorry for the delay to prepare and send you this message.
Attached is the invoice of imapsync software you bought ($date).
The invoice file is named facture_imapsync-${invoice}.pdf
This invoice is in PDF format, ready to be print.
If you need this invoice on paper, just ask me then
I will send it to you by postal mail.
In order to respect the law, this numeric invoice PDF
file is signed with my private gpg key.
The resulting gpg signature is in the file named
facture_imapsync-${invoice}.pdf.asc
also attached in this email message.
You can verify I (Gilles LAMIRAL) really generated
this invoice with the following command line
gpg --verify facture_imapsync-${invoice}.pdf.asc facture_imapsync-${invoice}.pdf
or any other gpg graphical tool.
I thank you again for buying and using imapsync.
Any feedback is welcome.
--
Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
} ;
my $message_body_blabla = qq{
Here is the fingerprint of my public key
pub 1024D/FDA2B3DC 2002-05-08
Key fingerprint = 7906 F53D 0D62 0C67 304A 4CF0 6928 869B FDA2 B3DC
uid Gilles LAMIRAL <gilles.lamiral\@laposte.net>
sub 1024g/A2C4CB42 2002-05-08
Of course the verification doesn't prove anything until
all the following conditions are met:
- you met me,
- I agree that the fingerprint above is really mine
- I prove I'm Gilles LAMIRAL with an official paper.
Normally we won't have to verify anything unless
I disagree with this invoice and the payment
you made for imapsync.
} ;
return( $message_header, $message_body ) ;
}
sub write_csv_info {
my( $dir_invoices, $invoice, $file_csv, $line_number, $line_csv ) = @_ ;
open( CSVINFO, "> $dir_invoices/$invoice/csv_info.txt") or die ;
print CSVINFO join( "\n", $file_csv, $line_number, $line_csv ) ;
close( CSVINFO ) ;
}
sub write_email_message {
my ( $dir_invoices, $invoice, $message_header, $message_body, $email_address ) = @_ ;
my $message_body_utf8 = to_utf8({ -string => $message_body, -charset => 'ISO-8859-1' });
mkdir( "$dir_invoices/$invoice" ) or die if ! -d "$dir_invoices/$invoice" ;
open( HEADER, "> $dir_invoices/$invoice/facture_message_header.txt") or die ;
print HEADER $message_header ;
close( HEADER ) ;
open( BODY, "> $dir_invoices/$invoice/facture_message_body.txt") or die ;
print BODY $message_body_utf8 ;
close( BODY ) ;
open( ADDRESS, "> $dir_invoices/$invoice/email_address.txt") or die ;
print ADDRESS "$email_address\n" ;
close( ADDRESS ) ;
}
sub write_tex_variables_file {
my ( $dir_invoices, $invoice, $date_jjSmmSaaaa, $tex_variables ) = @_ ;
my $tex_variables_utf8 = to_utf8({ -string => $tex_variables, -charset => 'ISO-8859-1' });
mkdir( "$dir_invoices/$invoice" ) or die if ! -d "$dir_invoices/$invoice" ;
open( FILE, "> $dir_invoices/$invoice/imapsync_var.tex") or die ;
print FILE $tex_variables_utf8 ;
close( FILE ) ;
}
sub download_urls {
my $date_jjSmmSaaaa = shift ;
my $date_aaaa_mm_jj = date_aaaa_mm_jj( $date_jjSmmSaaaa ) ;
# print "$date_aaaa_mm_jj $date_jjSmmSaaaa\n" ;
my ( $urlSrc, $urlExe ) ;
if ('2011_03_24' le $date_aaaa_mm_jj) {
$urlSrc = 'http://www.linux-france.org/prj/imapsync/paypal_return.shtml' ;
$urlExe = '' ;
return( $urlSrc, $urlExe ) ;
}
if ('2011_02_21' le $date_aaaa_mm_jj) {
$urlSrc = 'http://www.linux-france.org/depot/2011_02_21/OUMbo7/' ;
$urlExe = 'http://www.linux-france.org/depot/2011_02_21/rHSVNs/' ;
return( $urlSrc, $urlExe ) ;
}
if ('2011_01_18' le $date_aaaa_mm_jj) {
$urlSrc = 'http://www.linux-france.org/depot/2011_01_18/zPRRNt/' ;
$urlExe = 'http://www.linux-france.org/depot/2011_01_18/FO1QzG/' ;
return( $urlSrc, $urlExe ) ;
}
if ('2011_01_18' le $date_aaaa_mm_jj) {
$urlSrc = 'http://www.linux-france.org/depot/2010_11_28/SiNdlZ/' ;
$urlExe = 'http://www.linux-france.org/depot/2010_11_28/R3ZAyr/' ;
return( $urlSrc, $urlExe ) ;
}
$urlSrc = 'http://www.linux-france.org/depot/2010_11_08/X2PWMe/' ;
$urlExe = 'http://www.linux-france.org/depot/2010_11_08/ZZ7zSc/' ;
return( $urlSrc, $urlExe ) ;
}
sub date_aaaa_mm_jj {
my $date_jjSmmSaaaa = shift ;
if ( $date_jjSmmSaaaa =~ m{(\d\d)/(\d\d)/(\d\d\d\d)} ) {
my( $jj, $mm, $aaaa ) = ( $1, $2, $3 ) ;
return( join( '_', $aaaa, $mm, $jj ) ) ;
}else{
return( '9999_12_31' ) ;
}
}
sub tva_stuff {
my( $clientTypeEN, $Pays, $Hors_taxe, $Devise ) = @_ ;
my $priceTTCusd = '' ;
$Hors_taxe =~ s{,}{.} ;
if ( $Devise eq 'USD' ) {
$priceTTCusd = "(USD $Hors_taxe)" ;
$Hors_taxe = ( $Hors_taxe/$usdeur ) ;
}
my (
$priceHT,
$tvaFR,
$tvaEN,
$priceTVA,
$priceTTC,
$messageTVAFR,
$messageTVAEN,
) ;
if ( ( 'individual' eq $clientTypeEN)
or
( 'France' eq $Pays )
) {
$priceHT = sprintf('%2.2f', $Hors_taxe/1.196) ;
$tvaFR = '19,60\%';
$tvaEN = '';
$priceTVA = sprintf('%2.2f', $Hors_taxe/1.196*0.196) ;
$priceTTC = sprintf('%2.2f', $Hors_taxe) ;
$messageTVAFR = '';
$messageTVAEN = '';
}else{
$priceHT = sprintf('%2.2f', $Hors_taxe) ;
$tvaFR = 'néant';
$tvaEN = '(none)';
$priceTVA = 0 ;
$priceTTC = $priceHT;
$messageTVAFR = 'Exonération de TVA, article 259 B-1 du Code Général des Impôts';
$messageTVAEN = '(VAT tax-exempt, article 259 B-1 French General Tax Code)';
}
foreach my $price ( $priceHT, $priceTVA, $priceTTC, $priceTTCusd ) {
#print "[$price]\n" ;
$price =~ s{\.}{, } ;
}
return(
$priceHT,
$tvaFR,
$tvaEN,
$priceTVA,
$priceTTC,
$messageTVAFR,
$messageTVAEN,
$priceTTCusd
) ;
}
sub client_type {
my ( $Nom_Option_1, $Valeur_Option_1 ) = @_ ;
my ( $clientTypeEN, $clientTypeFR ) = ( 'professional', 'professionnel' ) ;
if ('imapsync usage' eq $Nom_Option_1 and 'individual' eq $Valeur_Option_1 ) {
$clientTypeEN = 'individual' ;
$clientTypeFR = 'individuel' ;
}elsif ('imapsync usage' eq $Nom_Option_1 and 'professional' eq $Valeur_Option_1 ) {
$clientTypeEN = 'professional' ;
$clientTypeFR = 'professionnel' ;
}
return( $clientTypeEN, $clientTypeFR ) ;
}
sub build_adress {
my(
$Nom,
$Adresse_1,
$Adresse_2_district_quartier,
$Ville,
$Code_postal,
$Etat_Province,
$Pays,
) = @_ ;
my $addr = "
===========================================================
Nom $Nom
Adresse_1 $Adresse_1
Adresse_2_district_quartier $Adresse_2_district_quartier
Ville Code_postal $Ville $Code_postal
Etat_Province $Etat_Province
Pays $Pays
" ;
#print $addr ;
my @address ;
$Nom = '' if ( $Nom =~ m/^\s+$/ ) ;
push( @address, $Nom ) if $Nom ;
push( @address, $Adresse_1 ) if $Adresse_1 ;
push( @address, $Adresse_2_district_quartier ) if $Adresse_2_district_quartier ;
push( @address, "$Ville $Code_postal" ) if ( $Ville or $Code_postal );
push( @address, $Etat_Province ) if $Etat_Province ;
push( @address, $Pays, ) if $Pays ;
my $clientAdrA = shift( @address ) || '' ;
my $clientAdrB = shift( @address ) || '' ;
my $clientAdrC = shift( @address ) || '' ;
my $clientAdrD = shift( @address ) || '' ;
my $clientAdrE = shift( @address ) || '' ;
my $clientAdrF = shift( @address ) || '' ;
$addr = "
[$clientAdrA]
[$clientAdrB]
[$clientAdrC]
[$clientAdrD]
[$clientAdrE]
[$clientAdrF]
";
#print $addr ;
return(
$clientAdrA,
$clientAdrB,
$clientAdrC,
$clientAdrD,
$clientAdrE,
$clientAdrF,
) ;
}

826
W/paypal_reply/paypal_bilan_1.27 Executable file
View file

@ -0,0 +1,826 @@
#!/usr/bin/perl
# $Id: paypal_bilan,v 1.27 2011/05/01 12:57:37 gilles Exp gilles $
use strict;
use warnings;
use Getopt::Long;
use Text::CSV_XS ;
use IO::Handle ;
use Data::Dumper ;
use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset);
die unless (utf8_supported_charset('ISO-8859-1'));
my $total_usd_received = 0 ;
my $total_usd_invoice = 0 ;
my $total_HT_EUR_exo = 0 ;
my $total_HT_EUR_ass = 0 ;
my $total_TVA_EUR = 0 ;
my $total_eur_received = 0 ;
my $total_eur_invoice = 0 ;
my $nb_invoice = 0 ;
my $nb_invoice_refund = 0 ;
my $nb_invoice_suspended = 0 ;
my $debug ;
my $debug_csv ;
my $debug_dev ;
my $first_invoice = 1 ;
my $print_details = '' ;
my $bnc = '';
my $usdeur = 1.2981 ;
my $invoices ;
my %invoice_refund ;
my %invoice_suspended ;
my $write_invoices = 0;
my $dir_invoices = '/g/var/paypal_invoices' ;
my $option_ret = GetOptions (
'debug' => \$debug,
'debug_csv' => \$debug_csv,
'debug_dev' => \$debug_dev,
'first_invoice=i' => \$first_invoice,
'print_details|details' => \$print_details,
'bnc' => \$bnc,
'usdeur=f' => \$usdeur,
'invoices=s' => \$invoices,
'write_invoices!' => \$write_invoices,
);
my @files = @ARGV ;
my %action_of_invoice ;
my @invoices = split( /\s+/, $invoices ) if $invoices ;
#print "@invoices\n" ;
foreach my $file ( @files ) {
my @actions = parse_file( $file ) ;
foreach my $action (@actions) {
my %action = %$action ;
#print $action->{ Nom }, "\n" ;
my( $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat,
$Devise, $Montant, $Numero_davis_de_reception, $Solde,
$Pays, $Nom_Option_1, $Valeur_Option_1, $Hors_taxe )
= @action{ ( 'Date', 'Heure', 'Fuseau horaire', 'Nom', 'Type', 'Etat',
'Devise', 'Montant', "Numéro d'avis de réception", 'Solde',
'Pays', 'Nom Option 1', 'Valeur Option 1', 'Hors taxe') } ;
#print "$Nom\n" ;
my $invoice = 'NONE' ;
$Montant = $action->{ Net } if not defined $Montant;
compute_line($action, $invoice, $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat,
$Devise, $Montant, $Numero_davis_de_reception, $Solde,
$Pays, $Nom_Option_1, $Valeur_Option_1, $Hors_taxe ) ;
# index by invoice number
$action_of_invoice{ $action->{ 'invoice' } } = $action ;
}
delete $action_of_invoice{ 'NONE' } ;
}
my $last_invoice = $first_invoice + $nb_invoice -1 ;
@invoices = ( $first_invoice .. $last_invoice ) if ( ! @invoices ) ;
my @invoice_sent ;
my %invoice_sent ;
my @invoice_not_sent ;
my %invoice_not_sent ;
foreach my $invoice ( @invoices ) {
my $action = $action_of_invoice{ $invoice } ;
my $email_address = $action->{ "De l'adresse email" } ;
my $invoice_sent = invoice_sent( $dir_invoices, $invoice, $email_address ) ;
#print "$invoice $invoice_sent\n" ;
if ( $invoice_sent ) {
$invoice_sent{ $invoice }++ ;
}else{
$invoice_not_sent{ $invoice }++ ;
build_invoice( $invoice ) ;
}
}
@invoice_sent = sort { $a <=> $b } keys( %invoice_sent ) ;
my $nb_invoice_sent = scalar( @invoice_sent ) ;
@invoice_not_sent = sort { $a <=> $b } keys( %invoice_not_sent ) ;
print "USD banque $total_usd_received\n" ;
print "USD invoice $total_usd_invoice\n" ;
my $total_eur_from_usd ;
$total_eur_from_usd = int( ( $total_usd_invoice / $usdeur ) + 0.5 ) ; # au 30 nov 2010 http://fr.finance.yahoo.com/devises/convertisseur/#from=EUR;to=USD;amt=1
print "EUR from USD $total_eur_from_usd\n" ;
#$total_eur = int( ( $total_eur_invoice / 1.3 ) + 0.5 ) ;
#print "EUR $total_eur_from_usd\n" ;
print "EUR banque $total_eur_received\n" ;
print "EUR invoice $total_eur_invoice\n" ;
my $total_eur = $total_eur_from_usd + $total_eur_invoice ;
$total_HT_EUR_exo = sprintf('%2.f', $total_HT_EUR_exo) ;
$total_HT_EUR_ass = sprintf('%2.f', $total_HT_EUR_ass) ;
$total_TVA_EUR = sprintf('%2.f', $total_TVA_EUR) ;
$total_eur = sprintf('%2.f', $total_eur) ;
print "EUR total $total_eur\n" ;
print "EUR total HT exo $total_HT_EUR_exo\n" ;
print "EUR total HT assuj $total_HT_EUR_ass\n" ;
print "EUR total TVA $total_TVA_EUR\n" ;
print "Nb invoice $nb_invoice ( from $first_invoice to $last_invoice )\n" ;
print "Nb invoice refund $nb_invoice_refund\n" ;
print "Nb invoice suspended $nb_invoice_suspended\n" ;
print "Nb invoice sent $nb_invoice_sent\n" ;
print "Have to send invoices @invoice_not_sent\n" if ( @invoice_not_sent ) ;
print "$total_eur != $total_HT_EUR_exo + $total_HT_EUR_ass + $total_TVA_EUR\n"
if ( $total_eur != $total_HT_EUR_exo + $total_HT_EUR_ass + $total_TVA_EUR ) ;
sub parse_one_line_io {
my $csv = shift ;
my $io = shift ;
my $line = $csv->getline($io) ;
return if ( $csv->eof( ) ) ;
if ( not defined( $line ) ) {
my($cde, $str, $pos) = $csv->error_diag () ;
print "[$cde] [$str] [$pos]\n" ;
}
return( $line ) ;
}
sub hash_and_count_dupplicate {
my @columns = @_ ;
my %columns ;
#@columns_def{ @columns_def } = ( ) ;
foreach my $col ( @columns ) {
$columns{ $col } += 1 ;
}
$debug_csv and print "Nb columns: ", scalar( keys %columns ), " ", scalar( @columns ), "\n" ;
# debug how many time a title is defined
foreach my $col (1 .. scalar( @columns )) {
$debug_csv and print "$col | ",
deci_to_AA( $col ) , " | ",
$columns{ $columns[ $col - 1 ] }, " | ",
$columns[ $col - 1 ], "\n" ;
}
# exit in case two columns have the same name
die "Erreur : doublons dans les titres\n" if ( scalar( keys %columns ) != scalar( @columns ) ) ;
return( %columns ) ;
}
sub deci_to_AA {
my $deci = shift ;
my $AA = '';
while ( $deci > 0 ) {
my $quot = int( ( $deci - 1 ) / 26 ) ;
my $rest = $deci - 1 - ( 26 * $quot ) ;
my $char = chr ( ord('A') + $rest ) ;
$AA = $char . $AA ;
$deci = $quot ;
}
#print "col=$AA\n" ;
return( $AA ) ;
}
sub remove_first_blank {
my $string = shift ;
$string =~ s/^ +// ;
return( $string ) ;
}
sub parse_file {
my $file = shift ;
open my $io, "<", $file or die "$file: $!" ;
my $csv = Text::CSV_XS->new( {
sep_char => ',',
binary => 1,
keep_meta_info => 1,
eol => $/,
} ) ;
my $line_1 = parse_one_line_io( $csv, $io ) ;
die if ( not defined $line_1 ) ; # first line must have no problem
my @columns_def_orig = @$line_1 ;
my @columns_def = map { remove_first_blank( $_ ) } @columns_def_orig ;
$debug_csv and print "columns_def = ", map( { "[$_]" } @columns_def ), "\n";
my %columns_def = hash_and_count_dupplicate( @columns_def ) ;
my $nb_columns_def = scalar @columns_def ;
my $line_counter = 2 ;
my @actions ;
while ( 1 ) {
$debug_csv and print "ligne $line_counter ", $csv->eof( ), "\n" ;
my $line = parse_one_line_io( $csv, $io ) ;
last if ( $csv->eof( ) ) ;
if ( not defined $line ) {
print "Erreur ligne $line_counter : ", $csv->error_diag, "\n\n";
++$line_counter ;
next ;
}
my @columns = @$line ;
if ( $nb_columns_def != scalar @columns ) {
print "Erreur ligne $line_counter : nombre de colonnes = ", scalar @columns, " != $nb_columns_def\n" ;
++$line_counter ;
next ;
}
my %columns ;
@columns{ @columns_def } = @columns ;
$columns{ 'file_csv' } = $file ;
$columns{ 'line_number' } = $line_counter ;
$csv->combine( @columns ) ;
my $line_csv = $csv->string();
$columns{ 'line_csv' } = $line_csv ;
$debug_csv and print map( { "[$_] = [" . $columns{$_} . "]\n" }
@columns_def, 'line_number', 'line_csv', 'file_csv' ),
"\n";
++$line_counter ;
push( @actions, \%columns ) ;
}
close( $io );
return( reverse @actions ) ;
}
sub compute_line {
my( $action, $invoice, $Date, $Heure, $Fuseau_horaire, $Nom, $Type, $Etat,
$Devise, $Montant, $Numero_davis_de_reception, $Solde,
$Pays, $Nom_Option_1, $Valeur_Option_1, $Hors_taxe_paypal ) = @_ ;
$debug and print( "[$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n",
"[$Pays] [$Nom_Option_1] [$Valeur_Option_1]\n" ) ;
#$debug_dev and print "$Hors_taxe_paypal\n" ;
$Montant =~ s/[^0-9-,.]//g ;
$Montant =~ s/,/./g ;
#$debug and print "MM[$Montant]\n" ;
$Hors_taxe_paypal =~ s/,/./g ;
my $MontantEUR;
my( $montant_HT_EUR_exo, $montant_HT_EUR_ass, $montant_TVA_EUR ) ;
if ( $bnc ) {
$MontantEUR = $Montant ;
$MontantEUR = sprintf( "%.4f", $Montant/$usdeur ) if ($Devise eq 'USD') ;
print( "\n", "=" x 60, "\n" ) ;
print( "[$Date] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [EUR $MontantEUR]\n",
"[$Pays] [$Nom_Option_1] [$Valeur_Option_1]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'USD' eq $Devise
and ( 'Terminé' eq $Etat or 'Compensé' eq $Etat )
) {
$Montant =~tr/,/./;
#print "$Montant\n" ;
my $Montant2_usd;
$Montant2_usd = $Hors_taxe_paypal ;
$total_usd_received += $Montant ;
$total_usd_invoice += $Montant2_usd ;
( $montant_HT_EUR_exo, $montant_HT_EUR_ass, $montant_TVA_EUR ) = tva_line( $Devise, $Montant2_usd, $Pays, $Nom_Option_1, $Valeur_Option_1 ) ;
$total_HT_EUR_exo += $montant_HT_EUR_exo ;
$total_HT_EUR_ass += $montant_HT_EUR_ass ;
$total_TVA_EUR += $montant_TVA_EUR ;
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and ( 'Terminé' eq $Etat or 'Compensé' eq $Etat )
) {
$Montant =~tr/,/./;
#print "$Montant\n" ;
my $Montant2_eur;
$Montant2_eur = $Hors_taxe_paypal ;
$total_eur_received += $Montant ;
$total_eur_invoice += $Montant2_eur ;
( $montant_HT_EUR_exo, $montant_HT_EUR_ass, $montant_TVA_EUR ) = tva_line( $Devise, $Montant2_eur, $Pays, $Nom_Option_1, $Valeur_Option_1 ) ;
$total_HT_EUR_exo += $montant_HT_EUR_exo ;
$total_HT_EUR_ass += $montant_HT_EUR_ass ;
$total_TVA_EUR += $montant_TVA_EUR ;
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Remboursé' eq $Etat
) {
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$nb_invoice_refund++;
$invoice_refund{ $invoice }++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Suspendu' eq $Etat
) {
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$nb_invoice_suspended++;
$invoice_suspended{ $invoice }++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
if (
'Paiement sur site marchand reçu' eq $Type
and 'EUR' eq $Devise
and 'Non compensé' eq $Etat
) {
$invoice = $first_invoice + $nb_invoice ;
$nb_invoice++ ;
$print_details and print ( "[$invoice] [$Date] [$Heure] [$Fuseau_horaire] [$Nom] [$Type] [$Etat] [$Devise] [$Montant] [$Numero_davis_de_reception] [$Solde]\n" ) ;
}
$action->{ 'invoice' } = $invoice ;
if ( $bnc ) {
my $FR_flag = '' ;
$FR_flag = ' FR' if $Pays eq 'France' ;
my $IND_flag = '' ;
$IND_flag = ' IND' if ('imapsync usage' eq $Nom_Option_1 and 'individual' eq $Valeur_Option_1 ) ;
print "FE $invoice$FR_flag$IND_flag\n" ;
print "Facture $invoice imapsync$FR_flag $Nom\n" ;
printf( "%.2f [EUR %.2f]\n", $Montant, $MontantEUR ) ;
}
}
sub build_invoice {
my $invoice = shift ;
return if ! $invoice ;
my $action = $action_of_invoice{ $invoice } ;
my $refund = '' ;
$refund = 'REFUND ' if $invoice_refund{ $invoice } ;
my %action = %$action if $action ;
#print Data::Dumper->Dump( [$action] ) ;
my( $Date, $Heure, $Nom, $Type, $Etat, $Devise, $Hors_taxe, $Commission, $Net,
$De_l_adresse_email, $A_l_adresse_email, $N_de_transaction, $Titre_de_l_objet,
$TVA, $Nom_Option_1, $Valeur_Option_1, $N_de_transaction_de_reference,
$Adresse_1, $Adresse_2_district_quartier, $Ville,
$Etat_Province, $Code_postal, $Pays, $line_number, $line_csv, $file_csv )
= @action{ ( 'Date', 'Heure', 'Nom', 'Type', 'Etat', 'Devise', 'Hors taxe', 'Commission', 'Net',
"De l'adresse email", "A l'adresse email", 'N° de transaction', "Titre de l'objet",
'TVA', 'Nom Option 1', 'Valeur Option 1', 'Nº de transaction de référence',
'Adresse 1', 'Adresse 2/district/quartier', 'Ville',
'Etat/Province/Région/Comté/Territoire/Préfecture/République', 'Code postal', 'Pays', 'line_number', 'line_csv', 'file_csv' ) } ;
#print "$Hors_taxe $Devise\n" ;
my $Hors_taxe_num = $Hors_taxe ;
$Hors_taxe_num =~ s{,}{.} ;
if ($Hors_taxe_num > 100) {
print "invoice $invoice $Hors_taxe_num > 100\n" ;
#return() ;
}
my ( $email_message_header, $email_message_body )
= build_email_message( $Date, $Nom, $De_l_adresse_email, $invoice ) ;
if ( $write_invoices and ! invoice_sent( $dir_invoices, $invoice, $De_l_adresse_email ) ) {
write_email_message( $dir_invoices, $invoice,
$email_message_header, $email_message_body,
$De_l_adresse_email) ;
write_csv_info( $dir_invoices, $invoice, $file_csv, $line_number, $line_csv ) ;
}
#print "==== $invoice $refund=================================================" ;
#print $email_message ;
my(
$clientAdrA,
$clientAdrB,
$clientAdrC,
$clientAdrD,
$clientAdrE,
$clientAdrF,
)
= build_adress(
$Nom,
$Adresse_1,
$Adresse_2_district_quartier,
$Ville,
$Code_postal,
$Etat_Province,
$Pays,
) ;
foreach my $str (
$De_l_adresse_email,
$Nom,
$clientAdrA,
$clientAdrB,
$clientAdrC,
$clientAdrD,
$clientAdrE,
$clientAdrF,
) {
$str =~ s{#}{\\#}g ;
$str =~ s{_}{\\_}g ;
$str =~ s{&}{\\&}g ;
}
my ( $clientTypeEN, $clientTypeFR ) = client_type( $Nom_Option_1, $Valeur_Option_1 ) ;
my (
$priceHT,
$tvaFR,
$tvaEN,
$priceTVA,
$priceTTC,
$messageTVAFR,
$messageTVAEN,
$priceTTCusd
)
= tva_stuff( $clientTypeEN, $Pays, $Hors_taxe, $Devise ) ;
my ( $urlSrc, $urlExe ) = download_urls( $Date ) ;
my $tex_variables = qq{
%% Begin input from $0
\\providecommand{\\invoiceNumber}{$invoice}
\\providecommand{\\clientName}{$Nom}
\\providecommand{\\clientEmail}{$De_l_adresse_email}
\\providecommand{\\clientTypeEN}{$clientTypeEN}
\\providecommand{\\clientTypeFR}{$clientTypeFR}
\\providecommand{\\clientAdrA}{$clientAdrA}
\\providecommand{\\clientAdrB}{$clientAdrB}
\\providecommand{\\clientAdrC}{$clientAdrC}
\\providecommand{\\clientAdrD}{$clientAdrD}
\\providecommand{\\clientAdrE}{$clientAdrE}
\\providecommand{\\clientAdrF}{$clientAdrF}
\\providecommand{\\invoiceDate}{$Date}
\\providecommand{\\invoiceHour}{$Heure}
\\providecommand{\\priceHT}{$priceHT}
\\providecommand{\\tvaFR}{$tvaFR}
\\providecommand{\\tvaEN}{$tvaEN}
\\providecommand{\\priceTVA}{$priceTVA}
\\providecommand{\\priceTTC}{$priceTTC}
\\providecommand{\\priceTTCusd}{$priceTTCusd}
\\providecommand{\\messageTVAFR}{$messageTVAFR}
\\providecommand{\\messageTVAEN}{$messageTVAEN}
\\providecommand{\\urlSrc}{\\url{$urlSrc}}
\\providecommand{\\urlExe}{\\url{$urlExe}}
%% End input from $0
} ;
#print $tex_variables ;
#print "$invoice ", invoice_sent( $dir_invoices, $invoice, $De_l_adresse_email ), "\n" ;
if ( $write_invoices and ! invoice_sent( $dir_invoices, $invoice, $De_l_adresse_email ) ) {
write_tex_variables_file( $dir_invoices, $invoice, $Date, $tex_variables ) ;
}
}
sub build_email_message {
my ( $date, $name, $email, $invoice ) = @_ ;
my $message_header = qq{X-imapsync: invoice $invoice
From: Gilles LAMIRAL <gilles.lamiral\@laposte.net>
Bcc: gilles\@lamiral.info
Subject: [imapsync invoice] $invoice ($date)
Disposition-Notification-To: Gilles LAMIRAL <gilles.lamiral\@laposte.net>
} ;
my $message_body = qq{
Hello $name,
First of all, I'm sorry for the delay in getting back to you.
You'll find in the attachment the invoice of imapsync software you bought ($date).
The invoice file is named facture_imapsync-${invoice}.pdf
This invoice is in PDF format, ready to be print.
Should you need a hardcopy of this invoice,
I'll send it to you upon request by regular mail.
As the law requires, this numeric invoice PDF file
is signed with my private gpg key.
The resulting gpg signature is in the file named
facture_imapsync-${invoice}.pdf.asc
you will also find in the attachment.
You can check I (Gilles LAMIRAL) really did generate
this invoice with the following command line:
gpg --verify facture_imapsync-${invoice}.pdf.asc facture_imapsync-${invoice}.pdf
or any other gpg graphical tool.
Once more, thank you for buying and using imapsync.
Any feedback is welcome.
--
Best Regards, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
} ;
my $message_body_blabla = qq{
Here is the fingerprint of my public key
pub 1024D/FDA2B3DC 2002-05-08
Key fingerprint = 7906 F53D 0D62 0C67 304A 4CF0 6928 869B FDA2 B3DC
uid Gilles LAMIRAL <gilles.lamiral\@laposte.net>
sub 1024g/A2C4CB42 2002-05-08
Of course the verification doesn't prove anything until
all the following conditions are met:
- you met me,
- I agree that the fingerprint above is really mine
- I prove I'm Gilles LAMIRAL with an official paper.
Normally we won't have to verify anything unless
I disagree with this invoice and the payment
you made for imapsync.
} ;
return( $message_header, $message_body ) ;
}
sub write_csv_info {
my( $dir_invoices, $invoice, $file_csv, $line_number, $line_csv ) = @_ ;
open( CSVINFO, "> $dir_invoices/$invoice/csv_info.txt") or die ;
print CSVINFO join( "\n", $file_csv, $line_number, $line_csv ) ;
close( CSVINFO ) ;
}
sub invoice_sent {
my ( $dir_invoices, $invoice, $email_address ) = @_ ;
return( 1 ) if ( -f "$dir_invoices/$invoice/SENT_TO_$email_address" ) ;
return( 0 ) ;
}
sub write_email_message {
my ( $dir_invoices, $invoice, $message_header, $message_body, $email_address ) = @_ ;
my $message_body_utf8 = to_utf8({ -string => $message_body, -charset => 'ISO-8859-1' });
mkdir( "$dir_invoices/$invoice" ) or die if ! -d "$dir_invoices/$invoice" ;
open( HEADER, "> $dir_invoices/$invoice/facture_message_header.txt") or die ;
print HEADER $message_header ;
close( HEADER ) ;
open( BODY, "> $dir_invoices/$invoice/facture_message_body.txt") or die ;
print BODY $message_body_utf8 ;
close( BODY ) ;
open( ADDRESS, "> $dir_invoices/$invoice/email_address.txt") or die ;
print ADDRESS "$email_address\n" ;
close( ADDRESS ) ;
}
sub write_tex_variables_file {
my ( $dir_invoices, $invoice, $date_jjSmmSaaaa, $tex_variables ) = @_ ;
my $tex_variables_utf8 = to_utf8({ -string => $tex_variables, -charset => 'ISO-8859-1' });
mkdir( "$dir_invoices/$invoice" ) or die if ! -d "$dir_invoices/$invoice" ;
open( FILE, "> $dir_invoices/$invoice/imapsync_var.tex") or die ;
print FILE $tex_variables_utf8 ;
close( FILE ) ;
}
sub download_urls {
my $date_jjSmmSaaaa = shift ;
my $date_aaaa_mm_jj = date_aaaa_mm_jj( $date_jjSmmSaaaa ) ;
# print "$date_aaaa_mm_jj $date_jjSmmSaaaa\n" ;
my ( $urlSrc, $urlExe ) ;
if ('2011_03_24' le $date_aaaa_mm_jj) {
$urlSrc = 'http://www.linux-france.org/prj/imapsync/paypal_return.shtml' ;
$urlExe = '' ;
return( $urlSrc, $urlExe ) ;
}
if ('2011_02_21' le $date_aaaa_mm_jj) {
$urlSrc = 'http://www.linux-france.org/depot/2011_02_21/OUMbo7/' ;
$urlExe = 'http://www.linux-france.org/depot/2011_02_21/rHSVNs/' ;
return( $urlSrc, $urlExe ) ;
}
if ('2011_01_18' le $date_aaaa_mm_jj) {
$urlSrc = 'http://www.linux-france.org/depot/2011_01_18/zPRRNt/' ;
$urlExe = 'http://www.linux-france.org/depot/2011_01_18/FO1QzG/' ;
return( $urlSrc, $urlExe ) ;
}
if ('2011_01_18' le $date_aaaa_mm_jj) {
$urlSrc = 'http://www.linux-france.org/depot/2010_11_28/SiNdlZ/' ;
$urlExe = 'http://www.linux-france.org/depot/2010_11_28/R3ZAyr/' ;
return( $urlSrc, $urlExe ) ;
}
$urlSrc = 'http://www.linux-france.org/depot/2010_11_08/X2PWMe/' ;
$urlExe = 'http://www.linux-france.org/depot/2010_11_08/ZZ7zSc/' ;
return( $urlSrc, $urlExe ) ;
}
sub date_aaaa_mm_jj {
my $date_jjSmmSaaaa = shift ;
if ( $date_jjSmmSaaaa =~ m{(\d\d)/(\d\d)/(\d\d\d\d)} ) {
my( $jj, $mm, $aaaa ) = ( $1, $2, $3 ) ;
return( join( '_', $aaaa, $mm, $jj ) ) ;
}else{
return( '9999_12_31' ) ;
}
}
sub tva_line {
my( $Devise, $Montant2, $Pays, $Nom_Option_1, $Valeur_Option_1 ) = @_ ;
my( $montant_HT_EUR_exo, $montant_HT_EUR_ass, $montant_TVA_EUR ) ;
$Montant2 = $Montant2/$usdeur if 'USD' eq $Devise ;
if (
( 'imapsync usage' eq $Nom_Option_1 and 'individual' eq $Valeur_Option_1 )
or
( 'France' eq $Pays )
) {
$montant_HT_EUR_exo = 0 ;
$montant_HT_EUR_ass = $Montant2 / 1.196 ;
$montant_TVA_EUR = $Montant2 / 1.196 * 0.196 ;
$debug_dev and print "$Montant2 $Pays $Valeur_Option_1\n" ;
}else{
$montant_HT_EUR_exo = $Montant2 ;
$montant_HT_EUR_ass = 0 ;
$montant_TVA_EUR = 0 ;
}
return( $montant_HT_EUR_exo, $montant_HT_EUR_ass, $montant_TVA_EUR ) ;
}
sub tva_stuff {
my( $clientTypeEN, $Pays, $Hors_taxe, $Devise ) = @_ ;
my $priceTTCusd = '' ;
$Hors_taxe =~ s{,}{.} ;
if ( $Devise eq 'USD' ) {
$priceTTCusd = "(usd $Hors_taxe)" ;
$Hors_taxe = ( $Hors_taxe/$usdeur ) ;
}
my (
$priceHT,
$tvaFR,
$tvaEN,
$priceTVA,
$priceTTC,
$messageTVAFR,
$messageTVAEN,
) ;
if ( ( 'individual' eq $clientTypeEN)
or
( 'France' eq $Pays )
) {
$priceHT = sprintf('%2.2f', $Hors_taxe/1.196) ;
$tvaFR = '19,60\%';
$tvaEN = '';
$priceTVA = sprintf('%2.2f', $Hors_taxe/1.196*0.196) ;
$priceTTC = sprintf('%2.2f', $Hors_taxe) ;
$messageTVAFR = '';
$messageTVAEN = '';
}else{
$priceHT = sprintf('%2.2f', $Hors_taxe) ;
$tvaFR = 'néant';
$tvaEN = '(none)';
$priceTVA = 0 ;
$priceTTC = $priceHT;
$messageTVAFR = 'Exonération de TVA, article 259 B-1 du Code Général des Impôts';
$messageTVAEN = '(VAT tax-exempt, article 259 B-1 French General Tax Code)';
}
foreach my $price ( $priceHT, $priceTVA, $priceTTC, $priceTTCusd ) {
#print "[$price]\n" ;
$price =~ s{\.}{, } ;
}
return(
$priceHT,
$tvaFR,
$tvaEN,
$priceTVA,
$priceTTC,
$messageTVAFR,
$messageTVAEN,
$priceTTCusd
) ;
}
sub client_type {
my ( $Nom_Option_1, $Valeur_Option_1 ) = @_ ;
my ( $clientTypeEN, $clientTypeFR ) = ( 'professional', 'professionnel' ) ;
if ('imapsync usage' eq $Nom_Option_1 and 'individual' eq $Valeur_Option_1 ) {
$clientTypeEN = 'individual' ;
$clientTypeFR = 'individuel' ;
}elsif ('imapsync usage' eq $Nom_Option_1 and 'professional' eq $Valeur_Option_1 ) {
$clientTypeEN = 'professional' ;
$clientTypeFR = 'professionnel' ;
}
return( $clientTypeEN, $clientTypeFR ) ;
}
sub build_adress {
my(
$Nom,
$Adresse_1,
$Adresse_2_district_quartier,
$Ville,
$Code_postal,
$Etat_Province,
$Pays,
) = @_ ;
my $addr = "
===========================================================
Nom $Nom
Adresse_1 $Adresse_1
Adresse_2_district_quartier $Adresse_2_district_quartier
Ville Code_postal $Ville $Code_postal
Etat_Province $Etat_Province
Pays $Pays
" ;
#print $addr ;
my @address ;
$Nom = '' if ( $Nom =~ m/^\s+$/ ) ;
push( @address, $Nom ) if $Nom ;
push( @address, $Adresse_1 ) if $Adresse_1 ;
push( @address, $Adresse_2_district_quartier ) if $Adresse_2_district_quartier ;
push( @address, "$Ville $Code_postal" ) if ( $Ville or $Code_postal );
push( @address, $Etat_Province ) if $Etat_Province ;
push( @address, $Pays, ) if $Pays ;
my $clientAdrA = shift( @address ) || '' ;
my $clientAdrB = shift( @address ) || '' ;
my $clientAdrC = shift( @address ) || '' ;
my $clientAdrD = shift( @address ) || '' ;
my $clientAdrE = shift( @address ) || '' ;
my $clientAdrF = shift( @address ) || '' ;
$addr = "
[$clientAdrA]
[$clientAdrB]
[$clientAdrC]
[$clientAdrD]
[$clientAdrE]
[$clientAdrF]
";
#print $addr ;
return(
$clientAdrA,
$clientAdrB,
$clientAdrC,
$clientAdrD,
$clientAdrE,
$clientAdrF,
) ;
}

1008
W/paypal_reply/paypal_bilan_1.33 Executable file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,101 @@
#!/bin/sh
# usage: sh paypal_build_invoices /g/var/paypal_invoices/???
lyx -e latex /home/gilles/public_html/AGIL/factures/000/facture_imapsync-000.lyx
cp /home/gilles/public_html/AGIL/factures/000/facture_imapsync-000.tex /g/var/paypal_invoices/
set -x
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 147 /g/paypal/paypal_2010_11_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 214 /g/paypal/paypal_2010_12_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 294 /g/paypal/paypal_2011_01_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 382 /g/paypal/paypal_2011_02_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 473 /g/paypal/paypal_2011_03_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 570 /g/paypal/paypal_2011_04_complet.csv
#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 645 /g/paypal/paypal_2011_05_complet.csv
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 733 /g/paypal/paypal_2011_06_complet.csv
/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 824 /g/paypal/paypal_2011_07_complet.csv
set +x
# La totale
: || /g/public_html/imapsync/W/paypal_reply/paypal_bilan --bnc --debug \
--first_in 147 --avoid_numbers '292 293 643 644 731 732' \
/g/paypal/paypal_201?_??_complet.csv
# USD de 147 à 340
# EUR de 341 à ...
# 20110413 Found problems with 189 199 249 258 263 359 537
# 20110412 Found problems with 189 199 242 249 258 263 359 382 537
# cen cen JAP cen cen cen cen TCH JAP
# cen
# 155 TVA 1,89
# 171 TVA 4,42
# 220 TVA 3,16
# 225 TVA 3,16
# 236 TVA 4,42
# 298 TVA 3,16
# 307 TVA 4,42
# 312 TVA 4,42
# 324 TVA 4,42
# 351 TVA 4,92
# 395 TVA 4,92
# 408 TVA 4,92
# 419 TVA 4,92
# 432 TVA 4,92
# 435 TVA 4,92
# 452 TVA 4,92
# 460 TVA 4,92
# 461 TVA 4,92
# 463 TVA 4,92
# 464 TVA 4,92
# 475 TVA 4,92
# 487 TVA 4,92
# 489 TVA 4,92
# 502 TVA 4,92
# 504 TVA 4,92
# 511 TVA 4,92
# 522 TVA 4,92
# 523 TVA 4,92
# 533 TVA 4,92
# 537 TVA 4,92
# 540 TVA 4,92
# 543 TVA 4,92
# 549 TVA 4,92
# 551 TVA 4,92
# 552 TVA 4,92
# 556 TVA 4,92
# 563 TVA 4,92
for d in "$@"; do
echo "==== $d ===="
cd $d
bd=`basename $d`
if ls SENT_TO_* 2>/dev/null ; then
echo "!!! Already sent "
continue
fi
rm -f facture_imapsync-$bd.tex
cp -f ../facture_imapsync-000.tex facture_imapsync-$bd.tex
if ! pdflatex facture_imapsync-$bd.tex < /dev/null > /dev/null; then
echo "PB $bd"
if test -f facture_imapsync-${bd}_good.tex \
&& pdflatex facture_imapsync-${bd}_good.tex < /dev/null > /dev/null
then
ln -f facture_imapsync-${bd}_good.pdf facture_imapsync-$bd.pdf
echo "PB $bd solved with manual facture_imapsync-${bd}_good.tex"
PB_LIST_MANUAL="$PB_LIST_MANUAL $bd"
else
PB_LIST="$PB_LIST $bd"
rm -f facture_imapsync-$bd.pdf
continue
fi
fi
gpg --use-agent --armor --detach-sign --yes facture_imapsync-$bd.pdf
done
echo "Found problems with $PB_LIST"
echo "Manual invoices for $PB_LIST_MANUAL"

208
W/paypal_reply/paypal_build_reply Executable file
View file

@ -0,0 +1,208 @@
#!/usr/bin/perl
# $Id: paypal_build_reply,v 1.16 2011/05/31 21:25:48 gilles Exp gilles $
use warnings;
use strict;
use Getopt::Long;
my ($msg_id_file, $msg_id);
my ($amount, $name, $email);
my (
$paypal_line, $paypal_info,
$buyer, $description, $object,
$url_source, $url_exe, $url, $release, $release_exe,
);
my $help ;
my $debug ;
my $numopt = scalar(@ARGV);
my $opt_ret = GetOptions(
"help" => \$help,
"debug!" => \$debug,
);
usage() and exit if ($help or ! $numopt) ;
$msg_id_file = $ARGV[1];
$msg_id = firstline($msg_id_file);
$debug and print "Hi!\n" ;
while(<>) {
next if ( ! /^(.*Num.+ro de transaction.*)$/ );
$paypal_line = $1;
$paypal_info = "===== Paypal id =====\n$paypal_line\n";
$debug and print "$paypal_info" ;
last;
}
while(<>) {
if ( /^Vous avez re.*paiement d'un montant de (.*) de la part de (.*) \((.*)\)/) {
($amount, $name, $email) = ($1, $2, $3);
last;
}
if ( /^Vous avez re.*paiement d'un montant de (.*) de la part de (.*)/) {
($amount, $name, $email) = ($1, "", $2);
last;
}
}
$release = firstline( '/g/public_html/imapsync/VERSION' ) ;
$release_exe = firstline( '/g/public_html/imapsync/VERSION_EXE' ) ;
my $path_last = firstline( '/g/public_html/imapsync/dist/path_last.txt' ) ;
$url_source = firstline( '/g/var/paypal_reply/url_source' ) ;
$url_exe = firstline( '/g/var/paypal_reply/url_exe' ) ;
$url = "http://ks.lamiral.info/imapsync/dist/$path_last/" ;
#print "[$amount] [$name] [$email] [$paypal_line]\n";
while(<>) {
if ( /^Acheteur/ ) {
$buyer .= "===== Acheteur =====\n";
last;
}
if ( /^Informations sur l'acheteur/ ) {
$buyer .= "===== Acheteur =====\n";
chomp( $name = <> );
$buyer .= "$name\n" ;
last;
}
}
while(<>) {
$buyer .= $_ if ( ! /^-----------------------------------/ );
last if ( /^-----------------------------------/ );
}
while(<>) {
next if ( ! /^Description :(.*)/ );
$object = $1 ;
$description = "===== Details =====\n";
$description .= $_;
last;
}
while(<>) {
$debug and print "LINE:$_" ;
$description .= $_;
last if ( /^Paiement envoy/ );
last if ( /^N.*d'avis de r.*ception/ );
}
my $address = 'gilles.lamiral@laposte.net';
my $address2 = 'gilles@lamiral.info';
my $rcstag = '$Id: paypal_build_reply,v 1.16 2011/05/31 21:25:48 gilles Exp gilles $';
my $download_info = "You will find the latest imapsync.exe binary (release $release_exe)
and the latest imapsync source code (release $release) at the following link:
$url" ;
my $next_releases ="Next imapsync releases will be available for one year without extra payment.
Just keep this message and ask for the new links.
(I will build an automatic subscription tool soon)" ;
my $thanks_software = "I thank you for buying and using imapsync,
I wish you successful transfers!" ;
my $thanks_support = "I thank you for buying support and using imapsync,
I wish you successful transfers, I will help you to succeed." ;
my $support_info = 'Now you have access to imapsync professional support.
You can contact me (Gilles LAMIRAL) by email or phone.
Email address: gilles.lamiral@laposte.net.
Professionnal phone number: +33 951 84 42 42 (France)
Mobile phone number: +33 620 79 76 06 (France).
I can call you back for free in many countries on landline telephone numbers
and to mobile numbers in the United States and France. So do not hesitate
to send me a note if you need vocal support.' ;
my $text_software = "$download_info\n
$next_releases\n
You will receive an invoice soon.\n
$thanks_software" ;
my $text_support = "$support_info\n
You will receive an invoice soon.\n
$thanks_support" ;
my $subject_software = "[imapsync download] imapsync release $release [$email]" ;
my $subject_support = "[imapsync support] imapsync release $release [$email]" ;
my $subject ;
my $text ;
if ( 'imapsync support' eq $object ) {
$text = $text_support ;
$subject = $subject_support ;
}else{
$text = $text_software ;
$subject = $subject_software ;
}
my $message = <<EOM
X-Comment: $rcstag
In-Reply-To: $msg_id
From: Gilles LAMIRAL <$address>
To: <$email>
Bcc: Gilles LAMIRAL <$address>, <$address2>
Subject: $subject
Hello $name,
$text
$paypal_info
$buyer
$description
==== Vendeur ====
Gilles LAMIRAL
4 La Billais
35580 Baulon
FRANCE
Tel: +33 951 84 42 42
Mob: +33 620 79 76 06
Fax: +33 956 84 42 42
email: $address
--
Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
EOM
;
=pod
=cut
print $message;
#print "[$amount] [$name] [$email] [$paypal_line] [$object]\n";
sub firstline {
# extract the first line of a file (without \n)
my($file) = @_;
my $line = "";
open FILE, $file or die("error [$file]: $! ");
chomp($line = <FILE>);
close FILE;
$line = ($line) ? $line: "error !EMPTY! [$file]";
return $line;
}

234
W/paypal_reply/paypal_functions Executable file
View file

@ -0,0 +1,234 @@
#!/bin/sh
# $Id: paypal_functions,v 1.17 2011/05/31 21:26:24 gilles Exp gilles $
paypal_prerequisites() {
perl -mMIME::Lite -e '' || echo 'sudo aptitude install libmime-lite-perl'
perl -mMIME::Parser -e '' || echo 'sudo aptitude install libmime-tools-perl'
perl -mUnicode::MapUTF8 -e '' || echo 'sudo aptitude install libunicode-maputf8-perl'
}
paypal_init_laposte() {
user=gilles.lamiral
passfile=/g/var/pass/secret.gilles_laposte
host=imap.laposte.net
tmpdir=/g/var/paypal_reply
folder=INBOX
}
paypal_init_petite() {
user=gilles@est.belle
passfile=/g/var/pass/secret.gilles_mbox
host=p
tmpdir=/g/var/paypal_reply
folder='INBOX.03_imapsync.imapsync_paypal'
}
paypal_init_petite_INBOX() {
user=gilles@est.belle
passfile=/g/var/pass/secret.gilles_mbox
host=p
tmpdir=/g/var/paypal_reply
folder='INBOX'
}
paypal_init_petite_dev() {
user=gilles@est.belle
passfile=/g/var/pass/secret.gilles_mbox
host=p
tmpdir=/g/var/paypal_reply_dev
folder='INBOX.03_imapsync.imapsync_paypal_dev'
}
get_mail() {
# creation des répertoires
mkdir -p $tmpdir/msg_in/
mkdir -p $tmpdir/msg_id/
(
cd $tmpdir/msg_in/
# recuperation des messages de la boite sans destruction des messages
# transférés
paypal_imapget --host $host --user $user --passfile $passfile \
--folder $folder
)
}
get_mail_PP1470() {
# creation des répertoires
mkdir -p $tmpdir/msg_in/
mkdir -p $tmpdir/msg_id/
(
cd $tmpdir/msg_in/
# recuperation des messages de la boite sans destruction des messages
# transférés
paypal_imapget --host $host --user $user --passfile $passfile \
--folder $folder --search TEXT --search PP1470
)
}
extract_mail() {
mkdir -p $tmpdir/msg_out/
test -z "`ls $tmpdir/msg_in/`" && echo no mail && return
(
cd $tmpdir/msg_out/
test -z "`ls .`" || rm -rf *_d
paypal_mimeexplode ../msg_in/*
)
#ls -d $tmpdir/msg_out/
}
convert_utf8() {
mkdir -p $tmpdir/msg_out_utf8/
test -z "`ls $tmpdir/msg_out/`" && echo no mail && return
for f in $tmpdir/msg_out/*_d/*.txt; do
b=`basename "$f"`
d=`dirname "$f"`
bd=`basename "$d"`
d_utf8="$tmpdir/msg_out_utf8/$bd"
f_utf8="$d_utf8/$b"
test -d "$d_utf8" && continue
mkdir "$d_utf8"
if file "$f" | grep -i UTF-8 > /dev/null
then
echo copying "$f" to "$f_utf8"
cp "$f" "$f_utf8"
else
echo converting "$f" to "$f_utf8"
8859_utf8 "$f" > "$f_utf8"
fi
done
}
troncate_last_2_chars() {
length=`expr length "$1"`
length_2=`expr $length - 2`
expr substr "$1" 1 $length_2
}
build_reply() {
mkdir -p $tmpdir/msg_reply/
for f in $tmpdir/msg_out_utf8/*/*.txt; do
#echo "$f"
d=`dirname "$f"`
bd=`basename "$d"`
file_id=`troncate_last_2_chars $bd`
d_reply="$tmpdir/msg_reply/$file_id"
test -f "$d_reply/$file_id.txt" && continue
mkdir -p "$d_reply"
echo building "$d_reply/$file_id.txt"
paypal_build_reply "$f" "$tmpdir/msg_id/$file_id" > "$d_reply/$file_id.txt"
done
}
build_reply_arg() {
for f in "$@"; do
#echo "$f"
d=`dirname "$f"`
bd=`basename "$d"`
file_id=`troncate_last_2_chars $bd`
d_reply="$tmpdir/msg_reply/$file_id"
echo building "$d_reply/$file_id.txt"
echo paypal_build_reply "$f" "$tmpdir/msg_id/$file_id"
paypal_build_reply "$f" "$tmpdir/msg_id/$file_id"
done
}
debug_mode() {
#return 0
return 1
}
send_reply() {
mkdir -p $tmpdir/msg_sent/
for f in $tmpdir/msg_reply/*/*.txt; do
b=`basename "$f"`
d=`dirname "$f"`
bd=`basename "$d"`
d_sent="$tmpdir/msg_sent/$bd"
debug_mode && echo "paypal_send $f"
test -f "$d_sent/$b" && continue
mkdir -p "$d_sent"
test X"--send" = X"$1" && paypal_send --send "$f" && touch "$d_sent/$b"
#test X"--send" = X"$1" && touch "$d_sent/$b"
test X"" = X"$1" && paypal_send "$f"
done
mailq
}
paypal_all() {
paypal_prerequisites
echo "Will get messages in $tmpdir/msg_in/"
get_mail
get_mail_PP1470
echo "Done get messages in $tmpdir/msg_in/"
echo "Will extract_mail in $tmpdir/msg_out/"
extract_mail
echo "Done extract_mail in $tmpdir/msg_out/"
echo "Will converting to utf8 in $tmpdir/msg_out_utf8/"
convert_utf8
echo "Done converting to utf8 in $tmpdir/msg_out_utf8/"
echo "Will build_reply in $tmpdir/msg_reply/"
build_reply
echo "Done build_reply in $tmpdir/msg_reply/"
echo "Will send_reply $@"
send_reply "$@"
echo "Done send_reply $@"
}
#echo 'paypal_reply_petite'
paypal_reply_petite() {
echo "Doing paypal_reply_petite"
echo paypal_init_petite
paypal_init_petite
paypal_all "$@"
echo paypal_init_petite_INBOX
paypal_init_petite_INBOX
paypal_all "$@"
echo "Done paypal_reply_petite"
}
#echo 'paypal_reply_laposte'
paypal_reply_laposte() {
echo "Doing paypal_reply_laposte"
echo paypal_init_laposte
paypal_init_laposte
paypal_all "$@"
echo "Done paypal_reply_laposte"
}
paypal_all_dev() {
paypal_prerequisites
echo "Will get messages in $tmpdir/msg_in/"
get_mail
get_mail_PP1470
echo "Done get messages in $tmpdir/msg_in/"
echo "Will extract_mail in $tmpdir/msg_out/"
extract_mail
echo "Done extract_mail in $tmpdir/msg_out/"
echo "Will converting to utf8 in $tmpdir/msg_out_utf8/"
convert_utf8
echo "Done converting to utf8 in $tmpdir/msg_out_utf8/"
echo "Will build_reply in $tmpdir/msg_reply/"
build_reply
echo "Done build_reply in $tmpdir/msg_reply/"
echo "Will send_reply $@"
send_reply "$@"
echo "Done send_reply $@"
}
paypal_reply_petite_dev() {
echo "Doing paypal_reply_petite_dev"
echo paypal_init_petite_dev
paypal_init_petite_dev
paypal_all_dev "$@"
echo "Done paypal_reply_petite_dev"
}

134
W/paypal_reply/paypal_imapget Executable file
View file

@ -0,0 +1,134 @@
#!/usr/bin/perl -w
# $Id: paypal_imapget,v 1.7 2011/03/23 17:05:24 gilles Exp gilles $
use Getopt::Long;
use Mail::IMAPClient;
use FileHandle;
my $host;
my $port = 143;
my $debugimap = 0;
my $debug = 0;
my $user;
my $password;
my $passfile;
my $folder = 'INBOX';
my @search ;
my $help;
my $numopt = scalar(@ARGV);
my $opt_ret = GetOptions(
"host=s" => \$host,
"user=s" => \$user,
"password=s" => \$password,
"passfile=s" => \$passfile,
"folder=s" => \$folder,
"search=s" => \@search,
"help" => \$help,
"delete!" => \$delete,
"expunge!" => \$expunge,
"debugimap!" => \$debugimap,
"debug!" => \$debug,
);
usage() and exit if ($help or ! $numopt) ;
$password = (defined($passfile)) ? firstline ($passfile) : $password;
my $imap = Mail::IMAPClient->new();
$imap->Server($host);
$imap->Port($port);
$imap->Uid(1);
$imap->Peek(1);
$imap->Debug($debugimap);
$imap->connect()
or die "Can not open imap connection on [$host] with user [$user] : $@\n";
$imap->User($user);
$imap->Password($password);
$imap->login() or die "Error login : [$host] with user [$user] : $@";
$imap->select($folder) or die "Error select folder [$folder] host [$host] user [$user] : $@";
#my @uids = $imap->search('HEADER', 'SUBJECT',"=?windows-1252?Q?Avis_de_r=E9ception_d=27un_paiement?=");
#my @uids = $imap->search('HEADER', 'Sender','sendmail@paypal.com');
#my @uids = $imap->search('TEXT', 'PP341');
print "@search\n" ;
@search = ('TEXT', 'PP341') if not @search ;
my @uids = $imap->search('HEADER', 'Sender','sendmail@paypal.com', @search );
print "Search: [@uids]\n";
foreach $msg (@uids) {
my $msg_id = $imap->get_header( $msg, "Message-Id" );
$debug and print "$msg_id\n";
my $msg_code = format_msg_id($msg_id);
my $file = "$msg_code";
if (-f $msg_code and -f "../msg_id/$msg_code") {
$debug and print "Already have $msg_code $msg\n";
next;
}
print "writing message $msg to $file\n";
unlink($file);
if ($imap->message_to_file($file, $msg)) {
$imap->delete_message($msg) if $delete;
$imap->expunge() if $expunge;
}else{
print "Error writing $file: $@\n";
}
write_to_file("../msg_id/$msg_code", $msg_id);
}
$imap->logout();
sub usage {
print <<EOF;
usage: $0 [options]
Several options are mandatory.
--host <string> : imap server. Mandatory.
--user <string> : user to login. Mandatory.
--password <string> : password for the user1. Mandatory.
--delete : mark messages well dumped as deleted
--expunge : expunge folder.
Example:
$0 \\
--host imap.troc.org --user foo --password secret
EOF
}
sub firstline {
# extract the first line of a file (without \n)
my($file) = @_;
my $line = "";
open FILE, $file or die("error [$file]: $! ");
chomp($line = <FILE>);
close FILE;
$line = ($line) ? $line: "error !EMPTY! [$file]";
return $line;
}
sub format_msg_id {
my $msg_id = shift;
$msg_id =~ tr/a-zA-Z0-9/_/cs;
$debug and print "$msg_id\n";
return($msg_id);
}
sub write_to_file {
my $file = shift;
my $string = shift;
$fh = FileHandle->new("> $file");
if (defined $fh) {
print $fh $string;
$fh->close;
}
}

187
W/paypal_reply/paypal_mimeexplode Executable file
View file

@ -0,0 +1,187 @@
#!/usr/bin/perl -w
# $Id: paypal_mimeexplode,v 1.1 2010/11/23 01:26:24 gilles Exp gilles $
=head1 NAME
mimeexplode - explode one or more MIME messages
=head1 SYNOPSIS
mimeexplode <mime-msg-file> <mime-msg-file> ...
someprocess | mimeexplode -
=head1 DESCRIPTION
Takes one or more files from the command line that contain MIME
messages, and explodes their contents out into subdirectories
of the current working directory. The subdirectories are
just called C<msg0>, C<msg1>, C<msg2>, etc. Existing directories are
skipped over.
The message information is output to the stdout, like this:
Message: msg3 (inputfile1.msg)
Part: msg3/filename-1.dat (text/plain)
Part: msg3/filename-2.dat (text/plain)
Message: msg5 (input-file2.msg)
Part: msg5/dir.gif (image/gif)
Part: msg5/face.jpg (image/jpeg)
Message: msg6 (infile3)
Part: msg6/filename-1.dat (text/plain)
This was written as an example of the MIME:: modules in the
MIME-parser package I wrote. It may prove useful as a quick-and-dirty
way of splitting a MIME message if you need to decode something, and
you don't have a MIME mail reader on hand.
=head1 COMMAND LINE OPTIONS
None yet.
=head1 AUTHOR
Eryq C<eryq@zeegee.com>, in a big hurry...
=cut
BEGIN { unshift @INC, ".." } # to test MIME:: stuff before installing it!
require 5.001;
use strict;
use Getopt::Long;
use vars qw($Msgno);
use MIME::Parser;
use Getopt::Std;
use File::Basename;
my $numopt = scalar(@ARGV);
my $help;
my $debug;
my $opt_ret = GetOptions(
"help" => \$help,
"debug!" => \$debug,
);
usage() and exit if ($help or ! $numopt) ;
sub usage {
print <<EOF;
Usage: $0 [options] email_1 email_2 ...
Options:
--help : print this message
--debug : verbose output
Example:
$0 email_1 email_2
EOF
}
#------------------------------------------------------------
# make_msg - make and return the name of a msgXXX directory
#------------------------------------------------------------
$Msgno = 1;
sub make_msg {
while (-d "msg$Msgno") {
++$Msgno;
die "self-imposed limit reached" if $Msgno == 256;
}
mkdir "msg$Msgno",0755 or die "couldn't make msg$Msgno: $!";
"msg$Msgno";
}
#------------------------------------------------------------
# make_msg_dir - make and return the name of a output directory
#------------------------------------------------------------
sub make_msg_dir {
my ($file) = @_;
if ("-" ne "$file") {
my $basefile = basename($file) . "_d";
-d $basefile and return($basefile);
mkdir $basefile or do {
warn "can not create directory $basefile: $!";
return undef;
};
return($basefile);
}else{
return(make_msg());
}
}
#------------------------------------------------------------
# dump_entity - dump an entity's file info
#------------------------------------------------------------
sub dump_entity {
my $ent = shift;
my @parts = $ent->parts;
if (@parts) { # multipart...
map { dump_entity($_) } @parts;
}
else { # single part...
$debug and print " Part: ", $ent->bodyhandle->path,
" (", scalar($ent->head->mime_type), ")\n";
}
}
#------------------------------------------------------------
# main
#------------------------------------------------------------
sub main {
my $file;
my $entity;
# Sanity:
(-w ".") or die "cwd not writable, you naughty boy...";
# Go through messages:
@ARGV or unshift @ARGV, "-";
while (defined($file = shift @ARGV)) {
my $msgdir = make_msg_dir($file);
next if not $msgdir;
$debug and print "Message: $msgdir ($file)\n";
# Create a new parser object:
my $parser = new MIME::Parser;
### $parser->parse_nested_messages('REPLACE');
# Optional: set up parameters that will affect how it extracts
# documents from the input stream:
$parser->output_dir($msgdir);
# Parse an input stream:
open FILE, $file or die "couldn't open $file";
$entity = $parser->read(\*FILE) or
print STDERR "Couldn't parse MIME in $file; continuing...\n";
close FILE;
# Congratulations: you now have a (possibly multipart) MIME entity!
dump_entity($entity) if $entity;
### $entity->dump_skeleton if $entity;
}
1;
}
exit (&main ? 0 : -1);
#------------------------------------------------------------
1;

30
W/paypal_reply/paypal_run_dev Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
# $Id: paypal_run_dev,v 1.5 2011/05/20 10:50:05 gilles Exp gilles $
set -e
#set -x
# Add path to commands at home
PATH=$PATH:/g/public_html/imapsync/W/paypal_reply
PERL5LIB=/g/public_html/imapsync/Mail-IMAPClient-3.28/lib
export PERL5LIB
test -f /g/public_html/imapsync/W/paypal_reply/paypal_functions \
&& . /g/public_html/imapsync/W/paypal_reply/paypal_functions
DATE_1=`date`
echo "==== paypal_reply_test ===="
paypal_reply_petite_dev "$@"
echo
DATE_2=`date`
echo "Debut : $DATE_1"
echo "Fin : $DATE_2"
echo "Yo Bery GOOD !"

View file

@ -0,0 +1,30 @@
#!/bin/sh
# $Id: paypal_run_laposte,v 1.4 2011/05/20 10:48:01 gilles Exp gilles $
set -e
#set -x
# Add path to commands at home
PATH=$PATH:/g/public_html/imapsync/W/paypal_reply
PERL5LIB=/g/public_html/imapsync/Mail-IMAPClient-3.28/lib
export PERL5LIB
test -f /g/public_html/imapsync/W/paypal_reply/paypal_functions \
&& . /g/public_html/imapsync/W/paypal_reply/paypal_functions
DATE_1=`date`
echo "==== paypal_reply_laposte ===="
paypal_reply_laposte "$@"
echo
DATE_2=`date`
echo "Debut : $DATE_1"
echo "Fin : $DATE_2"
echo "Yo Bery GOOD !"

View file

@ -0,0 +1,30 @@
#!/bin/sh
# $Id: paypal_run_petite,v 1.5 2011/03/23 17:02:39 gilles Exp $
set -e
#set -x
# Add path to commands at home
PATH=$PATH:/g/public_html/imapsync/paypal_reply
PERL5LIB=/g/public_html/imapsync/Mail-IMAPClient-3.28/lib
export PERL5LIB
test -f /g/public_html/imapsync/paypal_reply/paypal_functions \
&& . /g/public_html/imapsync/paypal_reply/paypal_functions
DATE_1=`date`
echo "==== paypal_reply_petite ===="
paypal_reply_petite "$@"
echo
DATE_2=`date`
echo "Debut : $DATE_1"
echo "Fin : $DATE_2"
echo "Yo Bery GOOD !"

71
W/paypal_reply/paypal_send Executable file
View file

@ -0,0 +1,71 @@
#!/usr/bin/perl
# $Id: paypal_send,v 1.3 2010/12/29 23:50:24 gilles Exp gilles $
use strict;
use warnings;
use Getopt::Long;
use MIME::Lite;
my (
$help,
$debug,
$send,
);
my $numopt = scalar(@ARGV);
my $opt_ret = GetOptions(
"help" => \$help,
"debug!" => \$debug,
"send!" => \$send,
);
usage() and exit if ($help or ! $numopt or ! $opt_ret) ;
my @reply = <>;
my %header;
while (my $line = shift @reply) {
#print $line;
chomp($line);
last if ($line =~ /^$/) ;
my($blank, $key, $value) = split /^(.+?:)\s*/, $line;
#print "[$key] [$value]\n";
$header{$key} = $value;
}
my $data = join('', @reply);
#print "[", $data, "]\n";
my $message = MIME::Lite->new();
$message->attr("content-type" => "text/plain");
$message->attr("content-type.charset" => "UTF-8");
$message->build(%header);
$message->build(Data => $data);
$message->print(\*STDOUT);
if ($send) {
$message->send;
print "Sent to ", $header{'To:'},"\n";
}
sub usage {
print <<EOF;
usage: $0 [options] file
--help : print this help message
--debug : verbose output
--send : send message
Examples:
$0 file
$0 --send file
EOF
}

View file

@ -0,0 +1,54 @@
#!/bin/sh
# $Id: paypal_send_invoices,v 1.6 2011/06/07 23:40:21 gilles Exp gilles $
# usages:
# sh paypal_send_invoices /g/var/paypal_invoices/147
# sh paypal_send_invoices /g/var/paypal_invoices/15?
send_invoice() {
test X"" = X"$1" && { echo "usage: send_invoice /g/var/paypal_invoices/147 vince@norestech.net"; return; }
d="$1"
echo "====== $d ======"
#echo
cd $d || return
bd=`basename $d`
#echo "$bd"
invoice="$bd"
if test -f WAIT_DONT_SEND; then
echo "found WAIT_DONT_SEND in $d then exit"
continue
fi
test -f facture_imapsync-${invoice}.pdf || { echo NO facture_imapsync-${invoice}.pdf ; return; }
test -f facture_imapsync-${invoice}.pdf.asc || { echo NO facture_imapsync-${invoice}.pdf.asc ; return; }
test -f facture_message_header.txt || { echo NO facture_message_header.txt ; return; }
test -f facture_message_body.txt || { echo NO facture_message_body.txt ; return; }
test -f email_address.txt || { echo NO email_address.txt ; return; }
email=${2:-`cat email_address.txt`}
> facture_message_to.txt
egrep '^To: ' facture_message_header.txt > /dev/null || echo "To: $email" > facture_message_to.txt
cat facture_message_header.txt facture_message_to.txt facture_message_body.txt > facture_message.txt
more facture_message.txt
echo '====== END of message ======'
test -f "SENT_TO_$email" && {
echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
echo "!!! Already SENT_TO_$email"
echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
}
mailq
test -f "SENT_TO_$email" || acroread facture_imapsync-${invoice}.pdf&
echo "Send this invoice ${invoice} to $email?"
read r < /dev/tty
echo SAID "[$r]"
test X"$r" = Xy && {
echo | mutt -H facture_message.txt -a facture_imapsync-${invoice}.pdf facture_imapsync-${invoice}.pdf.asc --
touch SENT_TO_$email
}
}
for d in "$@"; do
( send_invoice "$d" )
done

20
W/paypal_reply/texput.log Normal file
View file

@ -0,0 +1,20 @@
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6) (format=pdflatex 2010.5.16) 3 MAY 2011 20:33
entering extended mode
%&-line parsing enabled.
**facture_imapsync-700.tex
! Emergency stop.
<*> facture_imapsync-700.tex
End of file on the terminal!
Here is how much of TeX's memory you used:
3 strings out of 95086
127 string characters out of 1183255
45034 words of memory out of 1500000
3277 multiletter control sequences out of 10000+50000
3640 words of font info for 14 fonts, out of 1200000 for 2000
28 hyphenation exceptions out of 8191
0i,0n,0p,1b,6s stack positions out of 5000i,500n,6000p,200000b,5000s
! ==> Fatal error occurred, no output PDF file produced!

15
W/t/01_connect Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/perl -w
use Carp;
use Mail::IMAPClient;
$imap = Mail::IMAPClient->new(Debug => 1);
$imap->Debug(1);
$imap->Server('louloutte.dyndns.org');
$imap->connect() or croak "Error connecting @!";
$imap->User('MarkOv@est.belle');
$imap->Password('emhj91ly');
$imap->login();
$imap->logout();

16
W/t/01_connect.229.dump Normal file
View file

@ -0,0 +1,16 @@
Using Mail::IMAPClient version 2.2.9 and perl version 5.8.8 (5.008008)
Read: * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=PLAIN CRAM-MD5 CRAM-SHA1 IDLE STARTTLS] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc. See COPYING for distribution information.
Connect: Received this from readline: 0/OUTPUT/* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=PLAIN CRAM-MD5 CRAM-SHA1 IDLE STARTTLS] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc. See COPYING for distribution information.
Sending: 1 Login "XXXXXXXX" XXXXXXXX
Sent 37 bytes
Read: 1 OK LOGIN Ok.
Sending: 2 LOGOUT
Sent 10 bytes
Read: * BYE Courier-IMAP server shutting down
2 OK LOGOUT completed

35
W/t/02_append_string Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/perl -w
use Carp;
use Mail::IMAPClient;
$imap = Mail::IMAPClient->new();
$imap->Debug(0);
$imap->Server('louloutte.dyndns.org');
$imap->connect() or croak "Error connecting $@ !";
$imap->User('MarkOv@est.belle');
$imap->Password('emhj91ly');
$imap->login() or croak "Error login $@ !";
$imap->Uid(1) or croak "Error Uid $@ !";
print "[", $imap->folders, "]\n";
$imap->select('Inbox') or croak "Could not select: $@ !";
my @messages = $imap->messages or croak "Could not get message list: $@ !";
print "[@messages]\n";
$message = $messages[1];
print "[$message]\n";
my $string = $imap->message_string($message);
print $string;
#my $uid = $imap->append_string('INBOX.Trash', $string, '\Seen', "30-Oct-2006 01:34:14 +0100")
# or croak "Could not append_string: $@\n";
my $uid = $imap->append_string('INBOX.Trash', "$string", '\Seen', "")
or croak "Could not append_string: $@\n";
print "$uid\n";
$imap->logout();

53
W/t/03_message_to_file Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/perl -w
use Carp;
use Mail::IMAPClient;
use strict;
my $imap1 = Mail::IMAPClient->new();
$imap1->Debug(0);
$imap1->Server('louloutte.dyndns.org');
$imap1->connect() or croak "Error connecting $@ !";
$imap1->User('MarkOv@est.belle');
$imap1->Password('emhj91ly');
$imap1->login() or croak "Error login $@ !";
$imap1->Uid(1) or croak "Error Uid $@ !";
my $imap2 = Mail::IMAPClient->new();
$imap2->Debug(0);
$imap2->Server('louloutte.dyndns.org');
$imap2->connect() or croak "Error connecting $@ !";
$imap2->User('MarkOv@est.belle');
$imap2->User('titi@est.belle');
$imap2->Password('HUwtEd');
$imap2->login() or croak "Error login $@ !";
$imap2->Uid(1) or croak "Error Uid $@ !";
print "[", $imap1->folders, "]\n";
$imap1->select('Inbox') or croak "Could not select: $@ !";
$imap2->select('Inbox') or croak "Could not select: $@ !";
my @msg_id_2 = $imap2->messages;
my $msg_id_2 = $msg_id_2[1];
my $msg_id_1 = ($imap1->messages)[0];
print "msg_id_1: $msg_id_1\n";
my $string_2 = $imap2->message_string($msg_id_2);
print $string_2;
my $message_file_1 = "tmp_message_to_file_${$}_1";
my $message_file_2 = "tmp_message_to_file_${$}_2";
unlink($message_file_1);
unlink($message_file_2);
$imap2->message_to_file($message_file_2, $msg_id_2) or croak "Could not message_to_file";
$imap1->message_to_file($message_file_1, $msg_id_1) or croak "Could not message_to_file";
$imap1->logout();
$imap2->logout();

View file

@ -0,0 +1,91 @@
$RCSfile: imapsync,v $ $Revision: 1.244 $ $Date: 2008/02/29 22:43:22 $
Here is a [linux] system (Linux plume 2.6.20.3 #1 Sun Mar 25 06:07:36 CEST 2007 i686)
with perl 5.8.8 and the module Mail::IMAPClient version used here is 3.05
Command line used :
./imapsync --host1 localhost --user1 tata@est.belle --passfile1 /var/tmp/secret.tata --host2 localhost --user2 titi@est.belle --passfile2 /var/tmp/secret.titi --folder INBOX.Trash --syncinternaldates
will try to use CRAM-MD5 authentication on host1
will try to use CRAM-MD5 authentication on host2
From imap server [localhost] port [143] user [tata@est.belle]
To imap server [localhost] port [143] user [titi@est.belle]
Banner : * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=PLAIN CRAM-MD5 CRAM-SHA1 IDLE STARTTLS] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc. See COPYING for distribution information.
Host localhost says it has CAPABILITY for AUTHENTICATE CRAM-MD5
Success login on [localhost] with user [tata@est.belle] auth [CRAM-MD5]
Banner : * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=PLAIN CRAM-MD5 CRAM-SHA1 IDLE STARTTLS] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc. See COPYING for distribution information.
Host localhost says it has CAPABILITY for AUTHENTICATE CRAM-MD5
Success login on [localhost] with user [titi@est.belle] auth [CRAM-MD5]
From capability : QUOTA STARTTLS NAMESPACE CRAM-SHA1 IDLE AUTH=PLAIN THREAD=ORDEREDSUBJECT SORT UIDPLUS CHILDREN CRAM-MD5 IMAP4REV1 THREAD=REFERENCES
To capability : QUOTA STARTTLS NAMESPACE CRAM-SHA1 IDLE AUTH=PLAIN THREAD=ORDEREDSUBJECT SORT UIDPLUS CHILDREN CRAM-MD5 IMAP4REV1 THREAD=REFERENCES
From state Authenticated
To state Authenticated
From separator and prefix : [.][INBOX.]
To separator and prefix : [.][INBOX.]
++++ Calculating sizes ++++
From Folder [INBOX.Trash] Size: 1012 Messages: 1
Total size: 1012
Total messages: 1
Time : 1 s
++++ Calculating sizes ++++
To Folder [INBOX.Trash] Size: 0 Messages: 0
Total size: 0
Total messages: 0
Time : 0 s
++++ Listing folders ++++
From folders list : [INBOX.Trash]
To folders list : [INBOX.Trash]
++++ Looping on each folder ++++
From Folder [INBOX.Trash]
To Folder [INBOX.Trash]
++++ From [INBOX.Trash] Parse 1 ++++
++++ To [INBOX.Trash] Parse 1 ++++
++++ Verifying [INBOX.Trash] -> [INBOX.Trash] ++++
+ NO msg #2319 [1c8g+RBA0iMRz+/+c3pqXw:1012] in INBOX.Trash
+ Copying msg #2319:1012 to folder INBOX.Trash
AAAmessage_string[FCC: imap://tata%40est.belle@localhost/INBOX/Sent
X-Identity-Key: id2
Message-ID: <45454886.2030307@localhost>
Date: Mon, 30 Oct 2006 01:34:14 +0100
From: TATA <tata@localhost>
X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; uuencode=0
User-Agent: Thunderbird 1.5.0.4 (X11/20060722)
MIME-Version: 1.0
To: Gilles Lamiral <gilles@louloutte.dyndns.org>
Subject: Re: test:ophaifaibequahdu
References: <20030821153335.86EB6FCA2@louloutte.dyndns.org>
In-Reply-To: <20030821153335.86EB6FCA2@louloutte.dyndns.org>
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Gilles Lamiral wrote:
<blockquote cite="mid20030821153335.86EB6FCA2@louloutte.dyndns.org"
type="cite">
<pre wrap="">test:ophaifaibequahdu
</pre>
</blockquote>
<br>
</body>
</html>
]ZZZ
AAA1[]ZZZ
flags from : [\Seen]["30-Oct-2006 01:34:14 +0100"]
Time : 0 s
++++ Statistics ++++
Time : 2 sec
Messages transferred : 0
Messages skipped : 0
Total bytes transferred: 0
Total bytes skipped : 0
Total bytes error : 1012
Detected 1 errors
Please, rate imapsync at http://freshmeat.net/projects/imapsync/
?Happy with this free, open source and gratis GPL software?
Feel free to thank the author by giving him a book:
http://www.amazon.com/gp/registry/wishlist/1C9UNDIH3P7R7/
(or its paypal account gilles.lamiral@laposte.net)

21
W/t/04_parse_headers Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/perl -w
use Carp;
use Mail::IMAPClient;
$imap = Mail::IMAPClient->new(Debug => 1);
$imap->Debug(1);
$imap->Server('louloutte.dyndns.org');
$imap->connect() or croak "Error connecting @!";
$imap->User('MarkOv@est.belle');
$imap->Password('emhj91ly');
$imap->login();
$imap->select('Inbox');
my @messages = $imap->messages();
my $headers = $imap->parse_headers([@messages]);
$imap->logout();

26
W/t/05_parse_headers_ssl Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/perl -w
use Carp;
use Mail::IMAPClient;
use IO::Socket::SSL;
my $ssl = new IO::Socket::SSL("louloutte.dyndns.org:993");
my $imap = Mail::IMAPClient->new();
$imap->Socket($ssl);
$imap->Debug(1);
$imap->Server('louloutte.dyndns.org');
$imap->connect() or croak "Error connecting @!";
$imap->User('MarkOv@est.belle');
$imap->Password('emhj91ly');
$imap->login();
$imap->select('Inbox');
my @messages = $imap->messages();
my $headers = $imap->parse_headers([@messages]);
$imap->logout();

26
W/t/06_parse_headers_ssl_titi Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/perl -w
use Carp;
use Mail::IMAPClient;
use IO::Socket::SSL;
my $ssl = new IO::Socket::SSL("louloutte.dyndns.org:993");
my $imap = Mail::IMAPClient->new();
$imap->Socket($ssl);
$imap->Debug(1);
$imap->Server('louloutte.dyndns.org');
$imap->connect() or croak "Error connecting @!";
$imap->User('titi@est.belle');
$imap->Password('HUwtEd');
$imap->login();
$imap->select('Inbox');
my @messages = $imap->messages();
my $headers = $imap->parse_headers([@messages]);
$imap->logout();

116
W/tools/wonko_ruby_imapsync Normal file
View file

@ -0,0 +1,116 @@
#!/usr/bin/env ruby
require 'net/imap'
#
# http://wonko.com/article/554
#
# Gilles LAMIRAL: Your Ruby code is nice. Is it GPL? Can I make a reference
# to it in the imapsync distribution?
#
# Wonko : Please consider this code public domain (and unsupported).
# You're more than welcome to refer to it if you'd like.
#
#
# Source server connection info.
SOURCE_HOST = 'mail.example.com'
SOURCE_PORT = 143
SOURCE_SSL = false
SOURCE_USER = 'username'
SOURCE_PASS = 'password'
# Destination server connection info.
DEST_HOST = 'imap.gmail.com'
DEST_PORT = 993
DEST_SSL = true
DEST_USER = 'username@gmail.com'
DEST_PASS = 'password'
# Mapping of source folders to destination folders. The key is the name of the
# folder on the source server, the value is the name on the destination server.
# Any folder not specified here will be ignored. If a destination folder does
# not exist, it will be created.
FOLDERS = {
'INBOX' => 'INBOX',
'sourcefolder' => 'gmailfolder'
}
# Utility methods.
def dd(message)
puts "[#{DEST_HOST}] #{message}"
end
def ds(message)
puts "[#{SOURCE_HOST}] #{message}"
end
# Connect and log into both servers.
ds 'connecting...'
source = Net::IMAP.new(SOURCE_HOST, SOURCE_PORT, SOURCE_SSL)
ds 'logging in...'
source.login(SOURCE_USER, SOURCE_PASS)
dd 'connecting...'
dest = Net::IMAP.new(DEST_HOST, DEST_PORT, DEST_SSL)
dd 'logging in...'
dest.login(DEST_USER, DEST_PASS)
# Loop through folders and copy messages.
FOLDERS.each do |source_folder, dest_folder|
# Open source folder in read-only mode.
begin
ds "selecting folder '#{source_folder}'..."
source.examine(source_folder)
rescue => e
ds "error: select failed: #{e}"
next
end
# Open (or create) destination folder in read-write mode.
begin
dd "selecting folder '#{dest_folder}'..."
dest.select(dest_folder)
rescue => e
begin
dd "folder not found; creating..."
dest.create(dest_folder)
dest.select(dest_folder)
rescue => ee
dd "error: could not create folder: #{e}"
next
end
end
# Build a lookup hash of all message ids present in the destination folder.
dest_info = {}
dd 'analyzing existing messages...'
dest.uid_fetch(dest.uid_search(['ALL']), ['ENVELOPE']).each do |data|
dest_info[data.attr['ENVELOPE'].message_id] = true
end
# Loop through all messages in the source folder.
source.uid_fetch(source.uid_search(['ALL']), ['ENVELOPE']).each do |data|
mid = data.attr['ENVELOPE'].message_id
# If this message is already in the destination folder, skip it.
next if dest_info[mid]
# Download the full message body from the source folder.
ds "downloading message #{mid}..."
msg = source.uid_fetch(data.attr['UID'], ['RFC822', 'FLAGS',
'INTERNALDATE']).first
# Append the message to the destination folder, preserving flags and
# internal timestamp.
dd "storing message #{mid}..."
dest.append(dest_folder, msg.attr['RFC822'], msg.attr['FLAGS'],
msg.attr['INTERNALDATE'])
end
source.close
dest.close
end
puts 'done'

145
imapsync
View file

@ -20,7 +20,7 @@ Synchronise mailboxes between two imap servers.
Good at IMAP migration. More than 36 different IMAP server softwares
supported with success.
$Revision: 1.446 $
$Revision: 1.452 $
=head1 SYNOPSIS
@ -342,7 +342,7 @@ Failure stories reported with the following 3 imap servers:
Patient and confident testers are welcome.
- Imail 7.04 (maybe).
Success stories reported with the following 41 imap servers
Success stories reported with the following 44 imap servers
(software names are in alphabetic order):
- 1und1 H mimap1 84498 [host1]
@ -379,8 +379,10 @@ Success stories reported with the following 41 imap servers
- hMailServer 5.3.3 [host2], 4.4.1 [host1] (see FAQ)
- iPlanet Messaging server 4.15, 5.1, 5.2
- IMail 7.15 (Ipswitch/Win2003), 8.12, 11.03 [host1]
- Kerio 7.2.0P1 [host1]
- MailEnable 4.23 [host1] [host2]
- MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform), 12 [host2]
- MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform), 12 [host2],
12.0.3 [host1]
- Mercury 4.1 (Windows server 2000 platform)
- Microsoft Exchange Server 5.5, 6.0.6249.0[host1], 6.0.6487.0[host1],
6.5.7638.1 [host2], 6.5 [host1], Exchange 2007 SP1 (with Update Rollup 2),
@ -405,7 +407,7 @@ Success stories reported with the following 41 imap servers
(RedHat uses UW like 2003.338rh), v12.264 Solaris 5.7 (OSI Approved)
(http://www.washington.edu/imap/)
- UW - QMail v2.1
- Imap part of TCP/IP suite of VMS 7.3.2
- VMS, Imap part of TCP/IP suite of VMS 7.3.2
- Zimbra-IMAP 3.0.1 GA 160, 3.1.0 Build 279, 4.0.5, 4.5.2, 4.5.6,
Zimbra 5.0.24_GA_3356.RHEL4 [host1], 5.5, 6.x
@ -498,7 +500,7 @@ Entries for imapsync:
Feedback (good or bad) will often be welcome.
$Id: imapsync,v 1.446 2011/05/31 09:11:18 gilles Exp gilles $
$Id: imapsync,v 1.452 2011/07/11 00:29:06 gilles Exp gilles $
=cut
@ -560,6 +562,7 @@ my(
$syncacls,
$fastio1, $fastio2,
$maxsize, $minsize, $maxage, $minage,
$search,
$skipheader, @useheader,
$skipsize, $allowsizemismatch, $foldersizes, $buffersize,
$delete, $delete2,
@ -611,7 +614,7 @@ my(
# global variables initialisation
$rcs = '$Id: imapsync,v 1.446 2011/05/31 09:11:18 gilles Exp gilles $ ';
$rcs = '$Id: imapsync,v 1.452 2011/07/11 00:29:06 gilles Exp gilles $ ';
$total_bytes_transferred = 0;
$total_bytes_skipped = 0;
@ -687,8 +690,6 @@ if ( $fast ) {
# Activate --usecache if --useuid is set and no --nousecache
$usecache = 1 if ( $useuid and ( ! defined( $usecache ) ) ) ;
print banner_imapsync(@argv_copy);
print "Temp directory is $tmpdir\n";
@ -868,7 +869,7 @@ Use --nousecache or suppress the --max* --min* options\n" ) ;
my $imap1 = ();
my $imap2 = ();
$timestart = time();
$timestart = time( );
$timebefore = $timestart;
$debugimap1 and print "Host1 connection\n";
@ -1466,6 +1467,7 @@ sub modules_VERSION {
foreach my $module (qw(
Mail::IMAPClient
IO::Socket
IO::Socket::INET
IO::Socket::SSL
Digest::MD5
Digest::HMAC_MD5
@ -1803,8 +1805,8 @@ sub banner_imapsync {
my @argv_copy = @_;
my $banner_imapsync = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.446 $ ',
'$Date: 2011/05/31 09:11:18 $ ',
'$Revision: 1.452 $ ',
'$Date: 2011/07/11 00:29:06 $ ',
"\n",localhost_info(), "\n",
"Command line used:\n",
"$0 ", command_line_nopassword(@argv_copy), "\n",
@ -2407,16 +2409,16 @@ sub tests_permanentflags {
}
sub permanentflags {
my @lines = @_;
my @lines = @_ ;
foreach my $line (@lines) {
if ($line =~ m{\[PERMANENTFLAGS \(([^)]+?)\)\]}) {
$debug and print "permanentflags: $line";
my $permanentflags = $1;
if ($permanentflags =~ m{\\\*}) {
$permanentflags = '';
if ( $line =~ m{\[PERMANENTFLAGS \(([^)]+?)\)\]} ) {
( $debugflags or $debug ) and print "permanentflags: $line" ;
my $permanentflags = $1 ;
if ( $permanentflags =~ m{\\\*} ) {
$permanentflags = '' ;
}
return($permanentflags);
return($permanentflags) ;
};
}
}
@ -2496,36 +2498,44 @@ sub select_msgs {
my ( $imap, $msgs_all_hash_ref ) = @_ ;
my ( @msgs, @msgs_all, @max, @min, @union, @inter ) ;
# Need to have the whole list in msgs_all_hash_ref
# without calling messages() several times.
if ( defined( $msgs_all_hash_ref )
or ( ! defined( $maxage ) and ! defined( $minage ) )
or ( ! defined( $maxage ) and ! defined( $minage ) and ! defined( $search ) )
) {
@msgs = $imap->messages() ;
@msgs = $imap->messages() ;
if ( defined( $msgs_all_hash_ref ) ) {
@msgs_all = @msgs ;
@msgs_all = @msgs ;
@{ $msgs_all_hash_ref }{ @msgs_all } = () ;
}
if ( ! defined( $maxage ) and ! defined( $minage ) ) {
# return all messages
if ( ! defined( $maxage ) and ! defined( $minage ) and ! defined( $search ) ) {
return( @msgs ) ;
}
}
if (defined($maxage)) {
@max = $imap->sentsince(time - 86400 * $maxage);
if ( defined( $search ) ) {
@msgs = $imap->search( $search ) ;
return( @msgs ) ;
}
if ( defined( $maxage ) ) {
@max = $imap->sentsince( $timestart - 86400 * $maxage ) ;
}
if (defined($minage)) {
@min = $imap->sentbefore(time - 86400 * $minage);
if ( defined($minage ) ) {
@min = $imap->sentbefore( $timestart - 86400 * $minage ) ;
}
SWITCH: {
unless(defined($minage)) {@msgs = @max; last SWITCH};
unless(defined($maxage)) {@msgs = @min; last SWITCH};
my (%union, %inter);
foreach my $m (@min, @max) {$union{$m}++ && $inter{$m}++}
@inter = keys(%inter);
@union = keys(%union);
unless( defined( $minage ) ) { @msgs = @max ; last SWITCH } ;
unless( defined( $maxage ) ) { @msgs = @min ; last SWITCH } ;
my ( %union, %inter ) ;
foreach my $m ( @min, @max ) { $union{$m}++ && $inter{$m}++ }
@inter = keys( %inter ) ;
@union = keys( %union ) ;
# normal case
if ($minage <= $maxage) {@msgs = @inter; last SWITCH};
if ( $minage <= $maxage ) { @msgs = @inter ; last SWITCH } ;
# just exclude messages between
if ($minage > $maxage) {@msgs = @union; last SWITCH};
if ( $minage > $maxage ) { @msgs = @union ; last SWITCH } ;
}
return(@msgs);
@ -3315,6 +3325,7 @@ sub get_options {
"minsize=i" => \$minsize,
"maxage=i" => \$maxage,
"minage=i" => \$minage,
"search=s" => \$search,
"foldersizes!" => \$foldersizes,
"dry!" => \$dry,
"expunge!" => \$expunge,
@ -3551,7 +3562,7 @@ sub check_last_release {
}
sub imapsync_version {
my $rcs = '$Id: imapsync,v 1.446 2011/05/31 09:11:18 gilles Exp gilles $ ';
my $rcs = '$Id: imapsync,v 1.452 2011/07/11 00:29:06 gilles Exp gilles $ ';
$rcs =~ m/,v (\d+\.\d+)/;
my $VERSION = ($1) ? $1: "UNKNOWN";
return($VERSION);
@ -3731,17 +3742,17 @@ Several options are mandatory.
--regexflag <regex> : Apply the whole regex to each flags list.
Example: 's/\"Junk"//g' # to remove "Junk" flag.
--regexflag <regex> : and this one, etc.
--sep1 <string> : separator in case namespace is not supported.
--sep2 <string> : idem.
--delete : delete messages on host1 server after
--sep1 <string> : host1 separator in case namespace is not supported.
--sep2 <string> : idem for host2.
--delete : Deletes messages on host1 server after
a successful transfer. Useful in case you
want to migrate from one server to another one.
With imapsync, --delete tags messages as deleted and they
are really deleted unless --noexpunge is used.
With imapsync, --delete tags messages as deleted and
they are really deleted unless --noexpunge is used.
--delete2 : delete messages in host2 that are not in
host1 server.
--delete2folders : delete folders in host2 that are not in
host1 server. For safety, please try it like this (safe):
host1 server. Useful for backup or pre-sync.
--delete2folders : Delete folders in host2 that are not in host1 server.
For safety, first try it like this (it is safe):
--delete2folders --dry --justfolders --nofoldersizes
--delete2foldersonly <regex>: delete only folders matching regex.
--delete2foldersbutnot <regex>: do not delete folders matching regex.
@ -3751,8 +3762,8 @@ Several options are mandatory.
Newly transferred messages are also expunged if
option --delete is given.
No expunge is done on host2 account (unless --expunge2)
--expunge1 : expunge messages on host1 after the transfer of messages.
--expunge2 : expunge messages on host2 after the transfer of messages.
--expunge1 : Expunge messages on host1 after messages transfer.
--expunge2 : Expunge messages on host2 after messages transfer.
--uidexpunge2 : uidexpunge messages on the host2 account
that are not on the host1 account, requires --delete2
--syncinternaldates : sets the internal dates on host2 same as host1.
@ -3772,17 +3783,10 @@ Several options are mandatory.
past|+++++++++++++++minage---->now
past|----maxage+++++minage---->now (intersection)
past|++++minage-----maxage++++>now (union)
--skipheader <regex> : Don't take into account header keyword
matching <string> ex: --skipheader 'X.*'
--search <string> : Select messages returned by this IMAP SEARCH command
--useheader <string> : Use this header to compare messages on both sides.
Ex: Message-ID or Subject or Date.
--useheader <string> and this one, etc.
--skipsize : Don't take message size into account to compare
messages on both sides. On by default.
Use --no-skipsize for using size comparaison.
--allowsizemismatch : allow RFC822.SIZE != fetched msg size
consider also --skipsize to avoid duplicate messages
when running syncs more than one time per mailbox
--dry : do nothing, just print what would be done.
--subscribed : transfers subscribed folders.
--subscribe : subscribe to the folders transferred on the
@ -3812,14 +3816,6 @@ Several options are mandatory.
credentials, then exit.
--justfolders : just do things about folders (ignore messages).
--fast : be faster, equivalent to --nofoldersizes
--reconnectretry1 <int>: reconnect to host1 if connection is lost up to
<int> times per imap command (default is 3)
--reconnectretry2 <int>: same as --reconnectretry1 but for host2
--split1 <int> : split the requests in several parts on host1.
<int> is the number of messages handled per request.
default is like --split1 1000.
--split2 <int> : same thing on host2.
--timeout <int> : imap connect timeout.
--help : print this help.
Example: to synchronise imap account "foo" on "imap.truc.org"
@ -3839,6 +3835,29 @@ $thank
EOF
}
sub usage_complete {
print <<EOF ;
--skipheader <regex> : Don't take into account header keyword
matching <string> ex: --skipheader 'X.*'
--skipsize : Don't take message size into account to compare
messages on both sides. On by default.
Use --no-skipsize for using size comparaison.
--allowsizemismatch : allow RFC822.SIZE != fetched msg size
consider also --skipsize to avoid duplicate messages
when running syncs more than one time per mailbox
--reconnectretry1 <int>: reconnect to host1 if connection is lost up to
<int> times per imap command (default is 3)
--reconnectretry2 <int>: same as --reconnectretry1 but for host2
--split1 <int> : split the requests in several parts on host1.
<int> is the number of messages handled per request.
default is like --split1 1000.
--split2 <int> : same thing on host2.
--timeout <int> : imap connect timeout.
EOF
}
sub memory_consumption {
# memory consumed by imapsync until now in bytes
@ -3855,7 +3874,7 @@ sub memory_consumption_of_pids {
@val = memory_consumption_of_pids_win32(@PID);
}else{
# Unix
my @ps = qx{ ps -o vsz @PID };
my @ps = qx{ ps -o vsz -p @PID };
shift @ps; # First line is column name "VSZ"
chomp @ps;
# convert to

View file

@ -5,7 +5,7 @@
<title>Imapsync: an IMAP migration tool ( release <!--#exec cmd="cat VERSION"--> )</title>
<meta name="generator" content="Bluefish 1.0.7"/>
<meta name="author" content="Gilles LAMIRAL"/>
<meta name="date" content="2011-05-31T18:38:11+0200"/>
<meta name="date" content="2011-07-11T03:40:56+0200"/>
<meta name="copyright" content="None"/>
<meta name="keywords" content="imap, transfert, migration"/>
<meta name="description" content="imap migration tool"/>
@ -71,13 +71,22 @@ where the user plays independently on both sides. Use <b>offlineimap</b>
<p>New features or bugfixes since previous releases:</p>
<ul>
<li><b>1.452</b></li>
<li><b>New feature</b>: Added <b>--search</b> option allowing to <b>select messages</b> with the <b>powerful IMAP SEARCH</b> command.
<li><b>Bugfix</b>: Date reference to select messages with --maxdate --mindate is the beginning of imapsync run now.
<li>Bugfix: Fixed ps call to work with Solaris 10. Thanks to Daniel Rohde.
<li>Success: <b>Kerio 7.2.0P1</b> success story.
<li>Success: <b>MDaemon 12.0.3</b> success story.
<li><b>1.446</b></li>
<li><b>Bugfix</b>: Better --idatefromheader behavior (thank to Dax Kelson patches).</li>
<li><b>Usability</b>: Now --delete2 sets --uidexpunge2 instead of --expunge2 if possible.</li>
<li><b>Usability</b>: Adapted the usage output multiline character to Unix or Win, \ or ^</li>
<li><b>Bugfix</b>: Avoid a "not a number" warning when size is null.</li>
<li>Bugfix: Avoid a "not a number" warning when size is null.</li>
<li><b>Bugfix</b>: Added "Date" in the default --useheader list. It is ("Message-Id", "Message-ID", "Date")</li>
<li><b>Bugfix</b>: allows bad header beginning with a blank character.</li>
<li>Bugfix: allows bad header beginning with a blank character.</li>
<li><b>1.434</b></li>
<li><b>Bugfix</b>: Changed the way imapsync knows <b>whether a folder exists</b> or not. <b>Exchange</b> might be happy and <b>stop deconnecting</b> for this reason.</li>
@ -153,6 +162,7 @@ The Perl <b>imapsync</b> source code will run anywhere a <b>Perl interpreter can
</form>
<p>You will receive a download link <b>just after</b> the payment.<br/>
<b>One year</b> of imapsync <b>updates</b> without extra payment.<br/>
<b>30 days money-back guarantee!</b></p>
<h2><a id="buy_exe"></a>Buy standalone imapsync.exe for win32</h2>
@ -183,6 +193,7 @@ name="submit" alt="PayPal - The safer, easier way to pay online!"/>
</form>
<p>You will receive a download link <b>just after</b> the payment.<br/>
<b>One year</b> of imapsync <b>updates</b> without extra payment.<br/>
<b>30 days money-back guarantee!</b></p>
<!--
@ -193,10 +204,10 @@ The build system for imapsync.exe is XP Pro SP2 on a Intel Celeron 400 MHz 256 M
<h2><a id="buy_support"></a>Buy professional support for imapsync</h2>
<p>For <b>60 EUR</b> buy imapsync <b>support</b> by the developper who wrote and maintains imapsync.
<p>For <b>90 EUR</b> buy imapsync <b>support</b> by the developper who wrote and maintains imapsync.
</p>
<p>
60 EUR is equal to around <b>80 USD</b>, no problem to pay in USD (or any currency) with paypal:
90 EUR is equal to around <b>130 USD</b>, no problem to pay in USD (or any currency) with paypal:
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
@ -212,6 +223,9 @@ The build system for imapsync.exe is XP Pro SP2 on a Intel Celeron 400 MHz 256 M
</p>
</form>
<p>Then you will be able to expose your issues by email or phone and to converse until your issues are solved.
</p>
@ -327,8 +341,9 @@ will be to code it or fix it.<br/>
<h2><a id="imap_server_success"></a>Lists of imap server software failures and success stories</h2>
<p>Let's start with reported <b>failure stories</b> over the past
(maybe new imapsync release can run successfully with them).
<p>Let's start with reported <b>failure stories</b> over the past.<br/>
Maybe <b>new imapsync releases can run successfully with them</b>.<br/>
Don't hesitate to have a try, I will help you and make efforts to switch them to the success list.
</p>
<ul>
@ -337,7 +352,7 @@ will be to code it or fix it.<br/>
<li>MailEnable 1.54 (Proprietary) but MailEnable 4.23 is supported. </li>
</ul>
<p>Now the long reported <b>success stories</b> list (41 different imap server softwares)
<p>Now the long reported <b>success stories</b> list: <b>44 different imap server softwares supported!</b><br/>
([host1] means "source server", [host2] means "destination server"):
</p>
@ -377,8 +392,9 @@ will be to code it or fix it.<br/>
<li>hMailServer 5.3.3 [host2], 4.4.1 [host1], HMAILSERVER 5.3.2-B1769 on windows 2003 [hsot2]</li>
<li>iPlanet Messaging server 4.15, 5.1, 5.2</li>
<li>IMail 7.15 (Ipswitch/Win2003), 8.12, 11.03 [host1]</li>
<li>Kerio 7.2.0P1 [host1]</li>
<li><b>MailEnable</b> 4.23 [host1][host2], 4.26 [host1][host2]</li>
<li>MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform), 12 [host2]</li>
<li>MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform), 12 [host2], 12.0.3 [host1]</li>
<li>Mercury 4.1 (Windows server 2000 platform)</li>
<li><b>Microsoft Exchange Server</b> 5.5, 6.0.6249.0[host1], 6.0.6487.0[host1],
6.5.7638.1 [host2], 6.5 [host1], Exchange 2007 SP1 (with Update Rollup 2),
@ -435,7 +451,7 @@ alt="Viewable With Any Browser" />
<!--#config timefmt="%D" -->
<!--#config timefmt="%A %B %d, %Y" -->
<b>This document last modified on <!--#echo var="LAST_MODIFIED" --></b>
($Id: index.shtml,v 1.70 2011/05/31 16:43:38 gilles Exp gilles $)
($Id: index.shtml,v 1.75 2011/07/11 01:42:17 gilles Exp gilles $)
</p>
</body>

3
lfo.htaccess Normal file
View file

@ -0,0 +1,3 @@
Redirect Permanent /prj/imapsync/ http://ks.lamiral.info/imapsync/

74
memo
View file

@ -1,6 +1,6 @@
#!/bin/sh
# $Id: memo,v 1.31 2011/05/07 02:30:54 gilles Exp gilles $
# $Id: memo,v 1.32 2011/07/11 01:06:49 gilles Exp gilles $
software_version() {
@ -24,7 +24,23 @@ tail -f /usr/local/apache/logs/access_log|cat -n|grep prj/imapsync/VERSION|cat -
EOFF
}
statistics_VERSION() {
statistics_ks() {
cat <<EOFF
ssh root@ks "grep -h prj/imapsync/VERSION /var/log/apache2/access.log|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n" # list ip
ssh root@ks "grep -h prj/imapsync/VERSION /var/log/apache2/access.log|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n|wc" # count ip
ssh root@ks "grep -h prj/imapsync/VERSION /var/log/apache2/access.log|cut -d ' ' -f 1,12,13,18,19|sort -n|uniq -c|sort -n |grep MSWin32" # Win32
ssh root@ks "grep -h prj/imapsync/VERSION /var/log/apache2/access.log|cut -d ' ' -f 13,18,19 |sort -n|uniq -c| sort -n" # OS usage+basename
ssh root@ks "grep -h prj/imapsync/VERSION /var/log/apache2/access.log|cut -d ' ' -f 12 |sort -n|uniq -c| sort -n" # imapsync release
tail -f /usr/local/apache/logs/access_log|cat -n|grep prj/imapsync/VERSION|cat -n |grep VERSION # lfo frequency'
EOFF
}
statistics_VERSION_lfo() {
TMPDIR=.
export TMPDIR
@ -59,11 +75,59 @@ statistics_VERSION_monthly_runs() {
test -f stats_imapsync_2011_${month}.runs || wc -l linux-france.org.??-${month}-2011.imapsync_VERSION > stats_imapsync_2011_${month}.runs
cat stats_imapsync_2011_${month}.runs
}
}
statistics_VERSION_ks() {
TMPDIR=.
export TMPDIR
echo statistics_VERSION_getstats
statistics_VERSION_getstats() {
(
cd /home/imapsync/imapsync_stats
for f in /var/log/apache2/access.log_????????.gz ; do
b=`basename "$f" .gz`
echo "$b"
test -f ${b}.imapsync_VERSION && continue
echo NOT DONE ${b}.imapsync_VERSION
zgrep -h /prj/imapsync/VERSION "$f" > ${b}.imapsync_VERSION
done
)
}
echo statistics_VERSION_monthly_ip
statistics_VERSION_monthly_ip() {
month=$1
(
cd /home/imapsync/imapsync_stats
cut -d ' ' -f 1,12,13,18,19 access.log_2011${month}??.imapsync_VERSION |sort -n |uniq -c|sort -n > stats_imapsync_2011_${month}.ip
)
}
echo statistics_VERSION_monthly_ip_wc
statistics_VERSION_monthly_ip_wc() {
month=$1
(
cd /home/imapsync/imapsync_stats
test -f stats_imapsync_2011_${month}.ip || statistics_VERSION_monthly_ip $month
wc -l stats_imapsync_2011_${month}.ip
)
}
echo statistics_VERSION_monthly_runs
statistics_VERSION_monthly_runs() {
month=$1
(
cd /home/imapsync/imapsync_stats
# test -f stats_imapsync_2011_${month}.runs ||
wc -l access.log_2011${month}??.imapsync_VERSION > stats_imapsync_2011_${month}.runs
cat stats_imapsync_2011_${month}.runs
)
}
}
niouzes_compil() {
(
cd /g/public_html/www.linux-france.org/html/

View file

@ -4,8 +4,8 @@ cd C:\msys\1.0\home\Admin\imapsync
perl -mMail::IMAPClient -mDigest::MD5 -mTerm::ReadKey -mIO::Socket::SSL -mFile::Spec -mDigest::HMAC_MD5 -e ''
.\imapsync.exe
.\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --noauthmd5 --ssl1 --ssl2 --justconnect
.\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2
.\imapsync.exe --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX
.\imapsync.exe --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --noauthmd5 --delete2 --expunge2 --folder INBOX --usecache
.\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --justconnect
.\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --delete2
.\imapsync.exe --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --delete2 --folder INBOX
.\imapsync.exe --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --delete2 --folder INBOX --usecache

159
tests.sh
View file

@ -1,6 +1,6 @@
#!/bin/sh
# $Id: tests.sh,v 1.168 2011/05/31 16:42:38 gilles Exp gilles $
# $Id: tests.sh,v 1.170 2011/07/11 01:03:48 gilles Exp gilles $
# Example 1:
# CMD_PERL='perl -I./Mail-IMAPClient-3.25/lib' sh -x tests.sh
@ -354,7 +354,7 @@ ll_folderrec() {
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--folderrec INBOX.yop --debugimap --justfolders
--folderrec INBOX.yop --justfolders
}
ll_folderrec_star() {
@ -728,8 +728,6 @@ ll_noauthmd5()
}
ll_maxage()
{
can_send && sendtestmessage
@ -741,6 +739,54 @@ ll_maxage()
--maxage 1
}
ll_maxage_0()
{
can_send && sendtestmessage
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--maxage 0 --folder INBOX
}
ll_search_ALL()
{
can_send && sendtestmessage
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--search 'ALL' --folder INBOX
}
ll_search_FLAGGED()
{
can_send && sendtestmessage
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--search 'FLAGGED' --folder INBOX
}
ll_search_SENTSINCE()
{
can_send && sendtestmessage
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--search 'SENTSINCE 11-Jul-2011' --folder INBOX
}
ll_maxage_nonew()
{
can_send && sendtestmessage
@ -911,23 +957,52 @@ ll_exclude_INBOX()
ll_regextrans2()
{
if can_send; then
#echo3 Here is plume
sendtestmessage
else
:
fi
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--justfolders \
--nofoldersize \
--regextrans2 's/yop/yoX/' \
--folder 'INBOX.yop.yap'
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--justfolders \
--nofoldersize \
--regextrans2 's/yop/yoX/' \
--folder 'INBOX.yop.yap'
}
ll_regextrans2_downcase()
{
# lowercase the last basename part
# [INBOX.yop.YAP] -> [INBOX.yop.yap] using re [s/(.*)\Q${h1_sep}\E(.+)$/$1${h2_sep}\L$2\E/]
# [INBOX.yop.YAP] -> [INBOX.yop.yap]
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--justfolders \
--nofoldersize \
--regextrans2 's/(.*)\Q${h1_sep}\E(.+)$/$1${h2_sep}\L$2\E/' \
--folder 'INBOX.yop.YAP' --justfolders --debug --dry
}
ll_regextrans2_ucfirst()
{
# lowercase the last basename part
# [INBOX.yop.YAP] -> [INBOX.yop.yap] using re [s/(.*)\Q${h1_sep}\E(.+)$/$1${h2_sep}\L$2\E/]
# [INBOX.yop.YAP] -> [INBOX.yop.yap]
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--justfolders \
--nofoldersize \
--regextrans2 's/(.*)\Q${h1_sep}\E(.)(.+)$/$1${h2_sep}\u$2\L$3\E/' \
--folder 'INBOX.yop.YAP' --justfolders --debug --dry
}
ll_regextrans2_slash()
{
$CMD_PERL ./imapsync \
@ -1137,6 +1212,20 @@ ll_regex_flag3()
echo 'rm -f /home/vmail/titi/.yop.yap/cur/*'
}
ll_regex_flag4()
{
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--folder INBOX.yop.yap --nofoldersizes \
--regexflag 's/\$label1/\\label1/g' --debugflags
echo 'sudo rm -f /home/vmail/titi/.yop.yap/cur/*'
}
ll_regex_flag_keep_only()
{
$CMD_PERL ./imapsync \
@ -1675,6 +1764,23 @@ ll_usecache() {
--folder INBOX
}
ll_usecache_all() {
if can_send; then
sendtestmessage
else
:
fi
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--usecache --nofoldersizes
}
ll_nousecache() {
if can_send; then
@ -1767,11 +1873,22 @@ ll_useuid()
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--folder INBOX.useuid \
--delete2 --expunge2 \
--delete2 \
--useuid
echo 'rm /home/vmail/titi/.yop.yap/cur/*'
}
ll_useuid_all()
{
$CMD_PERL ./imapsync \
--host1 $HOST1 --user1 tata \
--passfile1 ../../var/pass/secret.tata \
--host2 $HOST2 --user2 titi \
--passfile2 ../../var/pass/secret.titi \
--delete2 --useuid --nofoldersizes
}
ll_useuid_nousecache()
{
$CMD_PERL ./imapsync \

0
tmp/cache/G1/G2/100_200 vendored Normal file
View file

0
tmp/cache/rr\uee/177_377 vendored Normal file
View file

4830
tmp/imapsync_1404 Executable file

File diff suppressed because it is too large Load diff

5273
tmp/imapsync_1434 Executable file

File diff suppressed because it is too large Load diff

384
tmp/index.shtml Normal file
View file

@ -0,0 +1,384 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>imapsync <!--#exec cmd="cat VERSION" --> </title>
<meta name="generator" content="Bluefish 1.0.7"/>
<meta name="author" content="Gilles LAMIRAL"/>
<meta name="date" content="2011-02-22T01:52:58+0100"/>
<meta name="copyright" content="None"/>
<meta name="keywords" content="imap, transfert, migration"/>
<meta name="description" content="imap migration tool"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
<meta http-equiv="content-style-type" content="text/css"/>
<meta http-equiv="expires" content="0"/>
<link rel="icon" type="image/png" href="logo_imapsync_s.png" />
<link href="style.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
.none
{
list-style-type: none;
}
</style>
</head>
<body>
<ul class="none">
<li>Buy <a href="#buy_source">imapsync <b>source code</b></a> (any OS)</li>
<li>Buy <a href="#buy_exe"><b>standalone win32</b></a> imapsync.exe</li>
<li>Are your <a href="#imap_server_success">imap servers <b>supported</b></a> by imapsync?</li>
</ul>
<div class="center">
<a href="http://www.linux-france.org/prj/imapsync/"><img src="logo_imapsync.png" width="486" height="309" alt="imapsync logo"/></a>
<h1>Welcome to the imapsync web site!</h1>
</div>
<h2>What is imapsync?</h2>
<p><b>imapsync</b> software is a command line tool allowing incremental and
recursive <b>imap</b> transfers from one mailbox to another, both anywhere on the internet
or in your local network.
</p>
<p><b>imapsync</b> is useful for imap account <b>migration</b> or imap account <b>backup</b>.
</p>
<p><b>imapsync</b> is <b>not adequate</b> for maintaining two active imap accounts in synchronization
where the user plays independently on both sides. Use <b>offlineimap</b>
(written by John Goerzen) for this purpose.
</p>
<h2><a id="AUTHOR"></a>Who is the author?</h2>
<p>Gilles LAMIRAL<br/>
Email: <b>gilles.lamiral@laposte.net</b></p>
<p>Good feedback is always welcome, bad feedback is often welcome.</p>
<h2><a id="WHERE_TALK"></a>Where to talk about imapsync?</h2>
<p>A nice place to talk about imapsync is the public
imapsync mailing-list (see below section <a href="#MAILING-LIST">Mailing-List</a>).
</p>
<h2><a id="latest"></a>Latest release is imapsync
<!--#exec cmd="cat VERSION" -->
</h2>
<p>Written on <!--#flastmod file="VERSION" --></p>
<p>See <a href="ChangeLog">ChangeLog</a> to know what's new in details.</p>
<p>New features since previous releases 1.383 and 1.398:</p>
<ul>
<li>Fixed the <b>not enough memory</b> issue with big messages by using perl module <b>Mail-IMAPClient 3.27</b> (thanks to Phil Pearl Lobbes)</li>
<li>New option <b>--useuid</b> to speed up or deal with problems using headers.</li>
<li>New option <b>--notakebody</b> to avoid getting first 2Ko body when got "no header"</li>
<li>Better performance of --usecache with MS Exchange</li>
<li>New option <b>--usecache</b> to speedup transfers when using multiple runs.</li>
</ul>
<p>The next imapsync release should see:</p>
<ul>
<li>An option to sync to and from files (local backup)</li>
</ul>
<h2><a id="buy_source"></a>Buy imapsync source code</h2>
<p>
The Perl <b>imapsync</b> source code will run anywhere a <b>Perl interpreter can run</b>: any Unix, Linux, Windows, or Mac OS operating system.
</p>
<p>Buy <b>latest</b> imapsync Perl <b>source code</b> for <b>30 EUR</b>
</p>
<p>
30 EUR is about <b>40 USD</b>, no problem to pay in USD with paypal:
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="on0" value="imapsync usage"/>imapsync usage
<select name="os0">
<option value="professional">professional </option>
<option value="individual">individual </option>
</select><br/>
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----
"/>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1"/>
</p>
</form>
<p>You will receive a download link in few minutes (contact me if the delay is over a couple of hours).<br/>
<b>30 days money-back guarantee.</b></p>
<h2><a id="buy_exe"></a>Standalone imapsync.exe for win32</h2>
<p>Struggle free from source code and Perl installation by<br/>
buying the latest win32 <b>standalone imapsync.exe</b> for <b>30 EUR</b></p>
<p>
30 EUR is about <b>40 USD</b>, no problem to pay in USD with paypal:
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="on0" value="imapsync usage"/>imapsync usage
<select name="os0">
<option value="professional">professional </option>
<option value="individual">individual </option>
</select><br/>
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----
"/>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1"/>
</p>
</form>
<p>You will receive a download link in few minutes (contact me if the delay is over a couple of hours).<br/>
<b>30 days money-back guarantee.</b></p>
<!--
<p>
thanks to Strawberry Perl 5.12 and Par::Packer module.<br/>
The build system for imapsync.exe is XP Pro SP2 on a Intel Celeron 400 MHz 256 Mo RAM. </p>
-->
<h2>Documentation</h2>
<p>Read the <a href="INSTALL">INSTALL</a> file to know how to install imapsync on your system.
</p>
<p>The <a href="README">README</a> file has many tips to understand imapsync and succeed in your migration or backup.
</p>
<p>The <a href="FAQ">FAQ</a> file presents Frequently Asked Questions (and not so frequently asked ones).
</p>
<p>The <a href="TODO">TODO</a> file list what may be coded or done in the future.<br/>
See also the <a href="#WANTED">wanted</a> section.
</p>
<p>All the people I thank are in the <a href="CREDITS">CREDITS</a> file.
</p>
<p>What you can do with imapsync is listed in <a href="COPYING">COPYING</a>.
</p>
<h2><a id="MAILING-LIST"></a>The imapsync mailing list</h2>
<p>
The public mailing-list may be the best way to get free support.<br/>
You can write to the mailing-list even if you're not subscribed to it.<br/>
In that case you will receive a confirmation message each time you post (to avoid spam).
</p>
<p>
To <b>write</b> on the mailing-list, the address is:
<b>imapsync@linux-france.org</b><br/>
</p>
<p>
To <b>subscribe</b>, send a message to:
<b>imapsync-subscribe@listes.linux-france.org</b><br/>
</p>
<p>
To <b>unsubscribe</b>, send a message to:
<b>imapsync-unsubscribe@listes.linux-france.org</b><br/>
</p>
<p>
To <b>contact</b> the person in charge for the list:
<b>imapsync-request@listes.linux-france.org</b><br/>
</p>
<p>
The <b>list archives</b> are available at
<a href="http://www.linux-france.org/prj/imapsync_list/">
http://linux-france.org/prj/imapsync_list/</a><br/>
So consider that the list is public, anyone can see your post.<br/>
<i>Use a pseudonym or do not post to
this list if you want to stay private</i>.<br/>
</p>
<form method="get" action="http://www.google.com/search">
<p> <b>Search</b> in the imapsync list <b>archives</b>:
<input type="text" name="q" value="migrate gmail exchange" size="30" />
<input type="hidden" name="as_sitesearch" value="www.linux-france.org/prj/imapsync_list/" />
(change the keywords with your own request and press <b>Enter</b>)
</p>
</form>
<p>
<b>Thank you for your participation to the imapsync mailing-list!</b>
</p>
<h2><a id="WANTED"></a>WANTED!</h2>
<p>I code new features and fix bugs for free when I have time and when I find it useful.<br/>
If you really want a feature or a fix you can donate money and my next development time
will be to code it or fix it.<br/>
</p>
<p>On february 2011: <b>1 EUR ~ 1.3 USD</b>.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCbeVy5f3ZJtNJT/EWmwanoXw/oiMWbd84jZibu3nVlbAKnuEJJpoutw9FI8QVe7bf5Zy/ZirHK4yULHU8JM4s4qYj3i/h1TvgG2xH+ouR1F941BdHycE7lUtiGMP6ccMtGXw8HjCrxnHY0HKKV/Ds6jBTMDla5Z7FH/bEVbWiYijELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIGO4SD08EDlKAgaCc8lvaFYx0ob5lAzp72h6BzCEsElWuLBjduVE4XW06AfqVrWJP7YEmBPDkBR/NxSMycch4GZHhNn/EVKjpOedqJ9PuG41B116wkapT7RFKhV/wRQarbZBcuqDvZoPSm/i78Sj64HZv+FAg1cfm0v3/l1HITF/Wv6HtfKnWrmFCv+YbCpSGVs7J6kNgRm3boZXqNLAz6XPm2hyda8H/22NWoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTEwMTE3MTIzNDE2WjAjBgkqhkiG9w0BCQQxFgQU2IXOUMUdj9JF0V0KMEKh/TLbyNgwDQYJKoZIhvcNAQEBBQAEgYBT51w/hYC5Psv9q2BOHPMYQ+1ypdwRUGJI2xmaOtgvoU+GMIyy+mKsHSMO6YQj1FXWENXujng0tWEXdyoN0PavpxvambJf0/PShV7YEfz4ksDGWIXC6MXFGB/B7VZGr5zFWjB3xMglx0XBdwQmTFmKjcbYMuAPnnvRpJl5bw5XhA==-----END PKCS7-----
"/>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!"/>
<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1"/>
</p>
</form>
<p>Some features and their time/money to be done evaluation:</p>
<table cellpadding="10" cellspacing="0" border="1">
<tr align="right"><th>DONE</th><th>Feature </th><th>Time guessed</th><th>Time spent</th><th>Money received</th><th>Money needed</th></tr>
<tr align="right"><td> No</td><td>Backup to files </td><td>20 hours </td><td> 60 min </td><td> 0 $ </td><td>800 $ </td></tr>
<tr align="right"><td> No</td><td>Efficient Gmail backup </td><td>20 hours </td><td> 80 min </td><td> 0 $ </td><td>800 $ </td></tr>
<tr align="right"><td> Yes</td><td>Add cache </td><td>10 hours </td><td>1310 min </td><td>400 $ </td><td>400 $ </td></tr>
<tr align="right"><td> Yes</td><td>Speedup 50% </td><td>10 hours </td><td> 80 min </td><td> 10 $ </td><td>400 $ </td></tr>
<tr align="right"><td> Yes</td><td>--delete2folders </td><td> 3 hours </td><td> 270 min </td><td> 90 $ </td><td> 0 $ </td></tr>
<tr align="right"><td> Yes</td><td>NTLM auth </td><td> 3 hours </td><td> 300 min </td><td> 15 $ </td><td>150 $ </td></tr>
<tr align="right"><td> Yes</td><td>Win32 imapsync.exe </td><td> 8 hours </td><td> 520 min </td><td> 45 $ </td><td>240 $ </td></tr>
<tr align="right"><td> Yes</td><td>Win32 bug fixes </td><td> various </td><td> 370 min </td><td>100 $ </td><td> 85 $ </td></tr>
<tr align="right"><td> Yes</td><td>Fix capability changes </td><td> 1 hour </td><td> 80 min </td><td> 0 $ </td><td> 40 $ </td></tr>
<tr align="right"><td> Yes</td><td>Large mailbox --maxage </td><td> 4 hours </td><td> 270 min </td><td> 0 $ </td><td>160 $ </td></tr>
<tr align="right"><td> Yes</td><td>dkimap support </td><td> 3 hours </td><td> 120 min </td><td> 0 $ </td><td>120 $ </td></tr>
<tr align="right"><td> No</td><td>gratis from here </td><td> 4 hours </td><td> 0 min </td><td> 0 $ </td><td>60000 $ </td></tr>
</table>
<h2><a id="imap_server_success"></a>Lists of imap server software failures and success stories</h2>
<p>Let's start with reported <b>failure stories</b> over the past
(maybe new imapsync release can run successfully with them).
</p>
<ul>
<li>DBMail 0.9, 2.0.7 (GPL). But most other DBMail releases work (see below)</li>
<li>Imail 7.04 (maybe).</li>
<li>MailEnable 1.54 (Proprietary) http://www.mailenable.com/</li>
</ul>
<p>Now the long reported <b>success stories</b> list
([host1] means "source server",
[host2] means "destination server"):
</p>
<ul>
<li>1und1 H mimap1 84498 [host1]</li>
<li>Archiveopteryx 2.03, 2.04, 2.09, 2.10 [host2], 3.0.0 [host2]
(OSL 3.0) http://www.archiveopteryx.org/</li>
<li>BincImap 1.2.3 (GPL) (http://www.bincimap.org/)</li>
<li>CommuniGatePro server (Redhat 8.0) (Solaris), CommuniGate Pro 5.2.17[host2] (CentOS 5.4)</li>
<li>Courier IMAP 1.5.1, 2.2.0, 2.1.1, 2.2.1, 3.0.8, 3.0.3, 4.1.1 (GPL)
(http://www.courier-mta.org/)</li>
<li>Critical Path (7.0.020)</li>
<li>Cyrus IMAP 1.5, 1.6, 2.1, 2.1.15, 2.1.16, 2.1.18
2.2.1, 2.2.2-BETA, 2.2.10, 2.2.12,
v2.2.3-Invoca-RPM-2.2.3-8,
2.3-alpha (OSI Approved),
v2.2.12-Invoca-RPM-2.2.12-3.RHEL4.1,
2.2.13,
v2.3.1-Invoca-RPM-2.3.1-2.7.fc5,
v2.3.1-Invoca-RPM-2.3.1-2.8.fc5 [host1],
v2.3.7,
(http://asg.web.cmu.edu/cyrus/)
</li>
<li>David Tobit V8 (proprietary Message system).</li>
<li>DBMail 1.2.1, 2.0.4, 2.0.9, 2.2rc1 (GPL) (http://www.dbmail.org/).
2.0.7 seems buggy.</li>
<li>Deerfield VisNetic MailServer 5.8.6 [host1]</li>
<li>dkimap4 [host1]</li>
<li>Domino (Notes) 4.61[host1], 6.5, 5.0.6, 5.0.7, 7.0.2, 6.0.2CF1, 7.0.1[host1], 8.0.1[host1]</li>
<li>Dovecot 0.99.10.4, 0.99.14, 0.99.14-8.fc4, 1.0-0.beta2.7,
1.0.0 [dest/source] (LGPL) (http://www.dovecot.org/)</li>
<li>Eudora WorldMail v2</li>
<li>GMX IMAP4 StreamProxy.</li>
<li>Groupwise IMAP (Novell) 6.x and 7.0. Buggy so see the FAQ.</li>
<li>hMailServer 5.3.3 [host2], 4.4.1 [host1], HMAILSERVER 5.3.2-B1769 on windows 2003 [hsot2]</li>
<li>iPlanet Messaging server 4.15, 5.1, 5.2</li>
<li>IMail 7.15 (Ipswitch/Win2003), 8.12</li>
<li>MDaemon 7.0.1, 8.0.2, 8.1, 9.5.4 (Windows server 2003 R2 platform)</li>
<li>Mercury 4.1 (Windows server 2000 platform)</li>
<li>Microsoft Exchange Server 5.5, 6.0.6249.0[host1], 6.0.6487.0[host1],
6.5.7638.1 [host2], Exchange 2007 SP1 (with Update Rollup 2),
Exchange2007-EP-SP2,
Exchange 2010 RTM (Release to Manufacturing) [host2]</li>
<li>Mirapoint server</li>
<li>Netscape Mail Server 3.6 (Wintel)</li>
<li>Netscape Messaging Server 4.15 Patch 7</li>
<li>OpenMail IMAP server B.07.00.k0</li>
<li>OpenWave</li>
<li>Oracle Beehive [host1]</li>
<li>Qualcomm Worldmail (NT)</li>
<li>Rockliffe Mailsite 5.3.11, 4.5.6</li>
<li>Samsung Contact IMAP server 8.5.0</li>
<li>Scalix v10.1, 10.0.1.3, 11.0.0.431</li>
<li>SmarterMail, Smarter Mail 5.0 Enterprise, Smarter Mail 5.5 [host1].</li>
<li>SunONE Messaging server 5.2, 6.0 (SUN JES - Java Enterprise System)</li>
<li>Sun Java(tm) System Messaging Server 6.2-2.05, 6.2-7.05, 6.3</li>
<li>Surgemail 3.6f5-5</li>
<li>UW-imap servers (imap-2000b) rijkkramer IMAP4rev1 2000.287
(RedHat uses UW like 2003.338rh), v12.264 Solaris 5.7 (OSI Approved)
(http://www.washington.edu/imap/)</li>
<li>UW - QMail v2.1</li>
<li>VMS, Imap part of TCP/IP suite of VMS 7.3.2</li>
<li>Zimbra-IMAP 3.0.1 GA 160, 3.1.0 Build 279, 4.0.5, 4.5.2, 4.5.6, 5.5, 6.x</li>
</ul>
<hr/>
<p>
<a href="http://validator.w3.org/check?uri=referer">
<img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Strict" height="31" width="88" />
</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px"
src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
alt="CSS Valide !" />
</a>
<a href="http://www.anybrowser.org/campaign/">
<img style="border:0;width:88px;height:31px"
src="http://www.anybrowser.org/campaign/bvgraphics/ab_jlh.png"
alt="Viewable With Any Browser" />
</a>
</p>
<hr/>
<p>
<!--#config timefmt="%D" -->
<!--#config timefmt="%A %B %d, %Y" -->
<b>This document last modified on <!--#echo var="LAST_MODIFIED" --></b>
($Id: index.shtml,v 1.57 2011/02/22 00:53:54 gilles Exp $)
</p>
</body>
</html>