@@ -59,11 +59,11 @@ public function __construct(MailerOptions $options)
59
59
*/
60
60
public function enqueue (\PHPMailer &$ email , SendindStatus &$ sendingStatus )
61
61
{
62
- // Nous traitons notre contenu
62
+ // processing email content and retreiving content database id
63
63
$ cont_id = $ this ->process_content ($ email );
64
64
65
- // Si nous avons un id, nous construisons le données de l' outbox et nous
66
- // les poussons dans la table prévue à cet effet
65
+ // if content processing going well, add email metadata into outbox and
66
+ // update the sending status of the whole email
67
67
if ($ cont_id !== false ) {
68
68
69
69
$ out_id = $ this ->db_outbox ->add (
@@ -95,32 +95,34 @@ public function enqueue (\PHPMailer &$email, SendindStatus &$sendingStatus)
95
95
*/
96
96
public function dequeue (\PHPMailer &$ email , SendindStatus &$ sendingStatus , $ max_sendingAttempts )
97
97
{
98
- // we refresh our scheduled elements before going further
98
+ // refreshing our scheduled elements before going further
99
99
$ this ->db_outbox ->refresh_scheduled (time ());
100
100
101
101
// get the next email to send from the queue
102
102
$ out_id = $ this ->db_outbox ->get_nextPending ($ max_sendingAttempts );
103
103
104
104
if ($ out_id !== false ) {
105
105
106
+ // retrieving outbox and content data
106
107
$ outbox = $ this ->db_outbox ->retrieve ($ out_id );
107
108
$ content = $ this ->db_content ->retrieve ($ outbox [modeles \Outbox::DB_CONT_ID ]);
108
109
109
- // Nous construisons notre contenu pour injection dans la base
110
+ // making email sending status
110
111
$ sendingStatus ->priority = $ outbox [modeles \Outbox::DB_PRIORITY ];
111
112
$ sendingStatus ->state = $ outbox [modeles \Outbox::DB_STATE ];
112
113
$ sendingStatus ->error = $ outbox [modeles \Outbox::DB_ERROR ];
113
114
$ sendingStatus ->attempts = $ outbox [modeles \Outbox::DB_ATTEMPTS ];
114
115
$ sendingStatus ->lastAction_ts = $ outbox [modeles \Outbox::DB_LAST_ACT ];
115
116
117
+ // making email metadata
116
118
$ this ->add_emailAttr ($ email , $ outbox [modeles \Outbox::DB_FROM ], 'From ' );
117
119
$ this ->add_emailAttr ($ email , $ outbox [modeles \Outbox::DB_REPLY ], 'ReplyTo ' );
118
120
$ this ->add_emailAttr ($ email , $ outbox [modeles \Outbox::DB_TO ], 'Address ' );
119
121
$ this ->add_emailAttr ($ email , $ outbox [modeles \Outbox::DB_CC ], 'CC ' );
120
122
$ this ->add_emailAttr ($ email , $ outbox [modeles \Outbox::DB_BCC ], 'BCC ' );
121
123
124
+ // constructing email content
122
125
if ($ content !== false ) {
123
-
124
126
$ email ->Subject = $ content [modeles \Content::DB_SUBJECT ];
125
127
$ email ->Body = $ content [modeles \Content::DB_BODY ];
126
128
$ email ->AltBody = $ content [modeles \Content::DB_ALT_BODY ];
@@ -145,7 +147,6 @@ public function dequeue (\PHPMailer &$email, SendindStatus &$sendingStatus, $max
145
147
146
148
// flushing old sent emails and old failed emails
147
149
$ this ->clean_db (time () - $ this ->sent_ttl );
148
-
149
150
return false ;
150
151
}
151
152
@@ -161,11 +162,12 @@ public function dequeue (\PHPMailer &$email, SendindStatus &$sendingStatus, $max
161
162
*/
162
163
public function archive (\PHPMailer &$ email , $ outbox_id = null )
163
164
{
164
- // Nous traitons notre contenu
165
+ // processing email content and retreiving content database id
165
166
$ cont_id = $ this ->process_content ($ email );
166
167
167
- // Si nous avons un id, nous construisons le données de l'outbox et nous
168
- // les poussons dans la table prévue à cet effet
168
+ // if content processing going well, add email metadata into sentbox,
169
+ // update the last action timestamp of the whole email
170
+ // and remove the email metadata from the outbox
169
171
if ($ cont_id !== false ) {
170
172
171
173
$ send_id = $ this ->db_sentbox ->add (
0 commit comments