Commit 56458d00903ce1c4000b43364f2d21955db2c6e4

Authored by totoro
1 parent 0900ff93

move the Send_tries from MailFountain to Calexium_lib

Showing 2 changed files with 18 additions and 7 deletions   Show diff stats
mail/send_mail.anubis
@@ -38,7 +38,7 @@ define Int _sendmail_time_out = 300. //5 minutes of timeout @@ -38,7 +38,7 @@ define Int _sendmail_time_out = 300. //5 minutes of timeout
38 public type Smtp_Recipient: 38 public type Smtp_Recipient:
39 smtp_recipient(String email, //email address of the recipient 39 smtp_recipient(String email, //email address of the recipient
40 40
41 - Int nb_tries, 41 + Send_Tries nb_tries,
42 Int uid, //parameter used by handle_status (mail_uid) 42 Int uid, //parameter used by handle_status (mail_uid)
43 Int uid2 //same (contact_id) 43 Int uid2 //same (contact_id)
44 ). 44 ).
@@ -48,7 +48,7 @@ public type Smtp_Recipient: @@ -48,7 +48,7 @@ public type Smtp_Recipient:
48 public type Send_Param: 48 public type Send_Param:
49 send_param( Str_HostName host_name, //domain of the sender like "mail.calexium.com" 49 send_param( Str_HostName host_name, //domain of the sender like "mail.calexium.com"
50 Str_Sender sender, //sender email address 50 Str_Sender sender, //sender email address
51 - List(Data_IO) mail_parts, //all parts of the email to send 51 + List(Data_IO) mail_parts, //all parts of the email to send
52 List(Smtp_Recipient) recipients, //recipient email address 52 List(Smtp_Recipient) recipients, //recipient email address
53 SmtpAuth auth, // 53 SmtpAuth auth, //
54 Str_UID mail_uid, 54 Str_UID mail_uid,
@@ -110,7 +110,8 @@ define Result(SmtpClientResult, One) @@ -110,7 +110,8 @@ define Result(SmtpClientResult, One)
110 SmtpClientSession sm_session, //smtp session 110 SmtpClientSession sm_session, //smtp session
111 (Int) -> One progress_report, //don't know what it is for the moment 111 (Int) -> One progress_report, //don't know what it is for the moment
112 (LogLevel, String) -> One logger, //logger 112 (LogLevel, String) -> One logger, //logger
113 - (Result(SmtpClientResult, One), Smtp_Recipient) -> One handle_result 113 + (Result(SmtpClientResult, One), Smtp_Recipient) -> One handle_result,
  114 + Bool unique_recipient
114 )= 115 )=
115 if recipients is 116 if recipients is
116 { 117 {
@@ -123,9 +124,12 @@ define Result(SmtpClientResult, One) @@ -123,9 +124,12 @@ define Result(SmtpClientResult, One)
123 //email to the next recipient within the same smtp session 124 //email to the next recipient within the same smtp session
124 if length(tail) > 0 then 125 if length(tail) > 0 then
125 send_rset(conn, sm_session, _sendmail_time_out, logger); 126 send_rset(conn, sm_session, _sendmail_time_out, logger);
126 - send_to_recipients_list(conn, param, tail, sm_session, progress_report, logger, handle_result) 127 + send_to_recipients_list(conn, param, tail, sm_session, progress_report, logger, handle_result, unique_recipient)
127 else 128 else
128 - ok(unique) 129 + if unique_recipient then
  130 + result
  131 + else
  132 + ok(unique)
129 } 133 }
130 . 134 .
131 135
@@ -169,7 +173,11 @@ public define Result(SmtpClientResult, One) @@ -169,7 +173,11 @@ public define Result(SmtpClientResult, One)
169 { 173 {
170 error(prepare_result) then error(prepare_result), 174 error(prepare_result) then error(prepare_result),
171 ok(new_param) then 175 ok(new_param) then
172 - with result = send_to_recipients_list(conn, new_param, new_param.recipients, sm_session, progress_report, logger, handle_result), 176 + with result =
  177 + if length(new_param.recipients) > 1 then
  178 + send_to_recipients_list(conn, new_param, new_param.recipients, sm_session, progress_report, logger, handle_result, false)
  179 + else
  180 + send_to_recipients_list(conn, new_param, new_param.recipients, sm_session, progress_report, logger, handle_result, true),
173 send_quit(conn, sm_session, _sendmail_time_out, logger); 181 send_quit(conn, sm_session, _sendmail_time_out, logger);
174 result 182 result
175 } 183 }
@@ -238,7 +246,7 @@ public define Result(SmtpClientResult, One) @@ -238,7 +246,7 @@ public define Result(SmtpClientResult, One)
238 error(error), 246 error(error),
239 247
240 ok(server_conn) then 248 ok(server_conn) then
241 - send_mail(server_conn, param, (Result(SmtpClientResult, One) dum, Smtp_Recipient my) |-> unique), 249 + send_mail(server_conn, param, (Result(SmtpClientResult, One) dum, Smtp_Recipient my) |-> println("send_mail Result(SmtpClientResult, One) ignored ")),
242 } 250 }
243 }. 251 }.
244 252
mail/send_mail_type.anubis
@@ -23,6 +23,9 @@ public type Str_Recipient: @@ -23,6 +23,9 @@ public type Str_Recipient:
23 23
24 public type Str_UID: 24 public type Str_UID:
25 str_UID(String str). 25 str_UID(String str).
  26 +
  27 +public type Send_Tries:
  28 + send_tries(Int number).
26 29
27 public type Send_Status: 30 public type Send_Status:
28 ready, //ready to send 31 ready, //ready to send