Commit 56458d00903ce1c4000b43364f2d21955db2c6e4
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 | 38 | public type Smtp_Recipient: |
| 39 | 39 | smtp_recipient(String email, //email address of the recipient |
| 40 | 40 | |
| 41 | - Int nb_tries, | |
| 41 | + Send_Tries nb_tries, | |
| 42 | 42 | Int uid, //parameter used by handle_status (mail_uid) |
| 43 | 43 | Int uid2 //same (contact_id) |
| 44 | 44 | ). |
| ... | ... | @@ -48,7 +48,7 @@ public type Smtp_Recipient: |
| 48 | 48 | public type Send_Param: |
| 49 | 49 | send_param( Str_HostName host_name, //domain of the sender like "mail.calexium.com" |
| 50 | 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 | 52 | List(Smtp_Recipient) recipients, //recipient email address |
| 53 | 53 | SmtpAuth auth, // |
| 54 | 54 | Str_UID mail_uid, |
| ... | ... | @@ -110,7 +110,8 @@ define Result(SmtpClientResult, One) |
| 110 | 110 | SmtpClientSession sm_session, //smtp session |
| 111 | 111 | (Int) -> One progress_report, //don't know what it is for the moment |
| 112 | 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 | 116 | if recipients is |
| 116 | 117 | { |
| ... | ... | @@ -123,9 +124,12 @@ define Result(SmtpClientResult, One) |
| 123 | 124 | //email to the next recipient within the same smtp session |
| 124 | 125 | if length(tail) > 0 then |
| 125 | 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 | 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 | 173 | { |
| 170 | 174 | error(prepare_result) then error(prepare_result), |
| 171 | 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 | 181 | send_quit(conn, sm_session, _sendmail_time_out, logger); |
| 174 | 182 | result |
| 175 | 183 | } |
| ... | ... | @@ -238,7 +246,7 @@ public define Result(SmtpClientResult, One) |
| 238 | 246 | error(error), |
| 239 | 247 | |
| 240 | 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