Bonjour à tous,

Afin d'aider une amie a lancer sont projet j’essaie de lui débloquer sont envoie de mailing "maison".

L'outil est bien fait, cependant il comporte un bug de taille que je n'arrive pas à résoudre.


Le principe est d'envoyer des emails selon les critères choisi sans spammé un domaine.

Donc si il y a 20 mail @yahoo.fr 20 mail @gmail.com il va envoyer par paquet de 5 sur les domaines en alternant.

En soit cela fonctionne, le problème est qu'il envoie le mail 2 4 fois sur la même adresse mail.

Exemeple
toto @yahoo.fr va le recevoir 1 fois
titi@gmail.fr 2 fois
gergege@huhu.fr 6 fois

Une fois le mailing crée il est stocké en base sous le format : Serialize

Puis un cron bien tout les 5 minutes voir ou en est le mailing, si il est toujours en cours il poursuit, si non il met en 'terminat'.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
 
 
Cron terminated at2011-Nov-01 11:17:01Test!
 
Starting cron at 2011-Nov-01 11:18:01
Starting cron at 2011-Nov-01 11:18:01Asked for multiple status filterAsked for multiple status filterLooking for tasks with the valid status "Array"Looking for tasks with the valid status "Array"array(1) {
array(1) {
  [0]=>
  [0]=>
    array(7) {
array(7) {
    ["    ["taskidtaskid"]=>
"]=>
        string(2) "string(2) "6060"
"
    ["    ["creation_datecreation_date"]=>
"]=>
        string(19) "string(19) "2011-11-01 11:17:062011-11-01 11:17:06"
"
    ["    ["statusstatus"]=>
"]=>
        string(7) "string(7) "pendingpending"
"
    ["    ["type_tasktype_task"]=>
"]=>
        string(7) "string(7) "mailingmailing"
"
    ["    ["start_datestart_date"]=>
"]=>
        NULL
NULL
    ["    ["updated_atupdated_at"]=>
"]=>
        string(19) "string(19) "2011-11-01 11:17:062011-11-01 11:17:06"
"
    ["    ["end_dateend_date"]=>
"]=>
        NULL
NULL
    }
}
}
}
Task constructor instancedTask constructor instanced1 rows matched the current id.1 rows matched the current id.Setting the object id.Setting the object id.object(Task)#2 (3) {
  [object(Task)#2 (3) {
"  [id""id]=>
"  ]=>
int(60)
    [int(60)
"status_before_lock":"Task":private  []=>
"status_before_lock":"Task":private  ]=>
NULL
    [NULL
"  [data""data]=>
"  ]=>
array(7) {
      ["array(7) {
taskid    [""]=>
taskid    "]=>
string(2) "    60string(2) ""
60    [""
creation_date    [""]=>
creation_date    "]=>
string(19) "    2011-11-01 11:17:06string(19) ""
2011-11-01 11:17:06    [""
status    [""]=>
status    "]=>
string(7) "    pendingstring(7) ""
pending    [""
type_task    [""]=>
type_task    "]=>
string(7) "    mailingstring(7) ""
mailing    [""
start_date    [""]=>
start_date    "]=>
NULL
        ["NULL
updated_at    [""]=>
updated_at    "]=>
string(19) "    2011-11-01 11:17:06string(19) ""
2011-11-01 11:17:06    [""
end_date    [""]=>
end_date    "]=>
NULL
      NULL
}
  }
}
}
Start() startedStart() startedRequest : UPDATE `cron_tasks` SET updated_at='2011-11-01 11:18:01' , status = 'in progress' WHERE taskid=60Request : UPDATE `cron_tasks` SET updated_at='2011-11-01 11:18:01' , status = 'in progress' WHERE taskid=60Task save successfulLaunching locking processLaunching setStatusLaunching status update.Task save successfulLaunching locking processLaunching setStatusRequest : UPDATE `cron_tasks` SET updated_at='2011-11-01 11:18:01' , status = 'locked' WHERE taskid=60Launching status update.Request : UPDATE `cron_tasks` SET updated_at='2011-11-01 11:18:01' , status = 'locked' WHERE taskid=60Task save successfulLoading external data...
SELECT * FROM `mailing_mails_to_send` WHERE taskid=60Task save successfulLoading external data...
SELECT * FROM `mailing_mails_to_send` WHERE taskid=60Unserializing object..Unserializing object..Object unserialized from :O:7:"Mailing":15:{s:13:"
Dans ce test tout frais :
xxx@free.fr => vient de le recevoir 6 fois
yyy@gmx.=> reçu 4 fois
pablo@yopmail.com=> 1 fois