Method code for $smtp.DATA()

[Turn off line numbering]
  1: arg c, body;
  2: var lines, code, line, i;
  3: 
  4: .set_timeout(c, 120);
  5: c.write("DATA");
  6: lines = (> .get_response(c) <);
  7: [code, line] = lines[1];
  8: if (code != 354)
  9:     throw(~error, lines.slice(2).join(), code);
 10: 
 11: // escape period DATA termination
 12: while ((i = find i in (body) where (i == ".")))
 13:     body = replace(body, i, "..");
 14: 
 15: // send it
 16: c.write(body + ["."]);
 17: lines = (> .get_response(c) <);
 18: [code, line] = lines[1];
 19: if (code != 250)
 20:     throw(~error, lines.slice(2).join(), code);

// Created 13-Oct-1996 as a part of ColdCore, see: @help Credit

Tlon