Commit 56c44e4d73a9e52b1343ce913a5f60d41187a2f9

Authored by totoro
1 parent 49aaa6dd

send mail without taking care about dot at beginning of each line. It's a respon…

…sibility of the application to give the file to the right format. Hence adding dot if need. This increase the speed of sending email
mail/smtp_client.anubis
... ... @@ -485,6 +485,41 @@ define SendContentResult
485 485 copy_error(so_far)
486 486 }.
487 487  
  488 +//public define Result(SmtpClientResult, One)
  489 +// send_content
  490 +// (
  491 +// RWStream conn,
  492 +// List(Data_IO) mail_part,
  493 +// SmtpClientSession session,
  494 +// Int timeout,
  495 +// (Int) -> One progress_report,
  496 +// (LogLevel, String) -> One logger
  497 +// ) =
  498 +// with start_time = now,
  499 +// if sm_copy_Data_IO_List_to_Stream(mail_part, conn, session, now, 0, progress_report, logger) is
  500 +// {
  501 +// smtp_reply(reply) then error(reply)
  502 +// copy_error(written) then
  503 +// with finish_time = now,
  504 +// logger(logError, "send_content: error sending data");
  505 +// logger(logTrace, "send_content: "+written+" bytes sent in "+finish_time - start_time+" second(s)");
  506 +// if written > 1024000 then
  507 +// logger(logInfo, "send_content: may be due to over sized mail. Convert it to 452 error.");
  508 +// error(reply(452, "", ["Error sending big email (more than 1 Mb)"]))
  509 +// else
  510 +// error(error),
  511 +// copy_ok(size) then
  512 +// if reliable_write(tcp(conn), [crlf_dot_crlf]) is
  513 +// {
  514 +// failure then logger(logError, "send_content: error writing CRLF.CRLF"); error(error),
  515 +// success(_) then
  516 +// with finish_time = (Int)now,
  517 +// logger(logTrace, "mail sent "+size+" bytes in "+finish_time - start_time+" second(s)");
  518 +// check_smtp_result(receive_reply(conn, session.enhanced_status, timeout, logger), 250, (SmtpClientResult _) |-> unique)
  519 +// }
  520 +// }.
  521 +
  522 +
488 523 public define Result(SmtpClientResult, One)
489 524 send_content
490 525 (
... ... @@ -496,30 +531,26 @@ public define Result(SmtpClientResult, One)
496 531 (LogLevel, String) -> One logger
497 532 ) =
498 533 with start_time = now,
499   - if sm_copy_Data_IO_List_to_Stream(mail_part, conn, session, now, 0, progress_report, logger) is
500   - {
501   - smtp_reply(reply) then error(reply)
502   - copy_error(written) then
503   - with finish_time = now,
504   - logger(logError, "send_content: error sending data");
505   - logger(logTrace, "send_content: "+written+" bytes sent in "+finish_time - start_time+" second(s)");
506   - if written > 1024000 then
507   - logger(logInfo, "send_content: may be due to over sized mail. Convert it to 452 error.");
508   - error(reply(452, "", ["Error sending big email (more than 1 Mb)"]))
509   - else
510   - error(error),
511   - copy_ok(size) then
512   - if reliable_write(tcp(conn), [crlf_dot_crlf]) is
513   - {
514   - failure then logger(logError, "send_content: error writing CRLF.CRLF"); error(error),
515   - success(_) then
516   - with finish_time = (Int)now,
517   - logger(logTrace, "mail sent "+size+" bytes in "+finish_time - start_time+" second(s)");
518   - check_smtp_result(receive_reply(conn, session.enhanced_status, timeout, logger), 250, (SmtpClientResult _) |-> unique)
519   - }
520   - }.
521   -
522   -
  534 + if copy_Data_IO_List_to_Stream(mail_part, weaken(conn)) is copy_ok(size) then
  535 + if reliable_write(tcp(conn), [crlf_dot_crlf]) is
  536 + {
  537 + failure then logger(logError, "send_content: error writing CRLF.CRLF"); error(error),
  538 + success(_) then
  539 + with finish_time = (Int)now,
  540 + logger(logTrace, "mail sent "+size+" bytes in "+finish_time - start_time+" second(s)");
  541 + check_smtp_result(receive_reply(conn, session.enhanced_status, timeout, logger), 250, (SmtpClientResult _) |-> unique)
  542 + }
  543 + else
  544 + with finish_time = now,
  545 + logger(logError, "send_content: error sending data");
  546 + logger(logTrace, "send_content: during "+finish_time - start_time+" second(s)");
  547 +// if written > 1024000 then
  548 +// logger(logInfo, "send_content: may be due to over sized mail. Convert it to 452 error.");
  549 +// error(reply(452, "", ["Error sending big email (more than 1 Mb)"]))
  550 +// else
  551 + error(error)
  552 + .
  553 +
523 554 Almost the same for 'QUIT':
524 555  
525 556 public define One
... ...
web/CXM_multihost_http_server.anubis
... ... @@ -2176,7 +2176,7 @@ define One
2176 2176 String filename // name of file
2177 2177 ) =
2178 2178 if sent >= size then unique else
2179   - if read(file,min(16384,size-sent),60) is
  2179 + if read(file,min(65536,size-sent),60) is
2180 2180 {
2181 2181 error then log_journal_msg(desc,"Cannot read from file '"+filename+"'.\n"),
2182 2182 timeout then log_journal_msg(desc,"Cannot read from file timeoput'"+filename+"'.\n"),
... ...