pike.git / lib / modules / Protocols.pmod / SMTP.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/SMTP.pmod:45:    switch(r) {    case 200..399:    break;    default:    throw(({"SMTP: "+c+"\n"+(comment?"SMTP: "+comment+"\n":"")+    "SMTP: "+reply_codes[r]+"\n", backtrace()}));    }    return r;    }    -  void create(void|string server, int|void port) +  void create(void|string|Stdio.File server, int|void port)    {    if(!server)    {    // Lookup MX record here (Using DNS.pmod)    object dns=master()->resolv("Protocols")["DNS"]->client();    server=dns->get_primary_mx(gethostname());    }    -  +  werror("server=%O\n",server); +  if (objectp(server)) +  assign(server); +  else +  {    if(!port)    port = 25;       if(!server || !connect(server, port))    {    throw(({"Failed to connect to mail server.\n",backtrace()}));    } -  +  }       if(readreturncode()/100 != 2)    throw(({"Connection refused by SMTP server.\n",backtrace()}));       if(catch(cmd("EHLO "+gethostname())))    cmd("HELO "+gethostname(), "greeting failed.");    }       void send_message(string from, array(string) to, string body)    {