Method code for $smtp.connect_to_smtp_host()

[Turn off line numbering]
  1: arg ip, @host;
  2: var line, c;
  3: 
  4: if (host)
  5:     host = host[1];
  6: else
  7:     host = ip;
  8: c = $outbound_connection.new();
  9: catch any {
 10:     c.open_connection(ip, 25);
 11:     (> .negotiate_connect(c) <);
 12: } with {
 13:     (| c.close() |);
 14:     if (error() == ~refused)
 15:         throw(~refused, "Unable to open SMTP connection to " + host);
 16:     else
 17:         rethrow(error());
 18: }
 19: return c;

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

Tlon