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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/SMTP.pmod:54:    {    if(!server)    {    // Lookup MX record here (Using DNS.pmod)    object dns=master()->resolv("Protocols")["DNS"]->client();    server=dns->get_primary_mx(gethostname());    }       if(!connect(server,25))    { -  throw(({"Failed to connect to news server.\n",backtrace()})); +  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, string *to, string body)    { -  cmd("MAIL FROM:"+from); +  cmd("MAIL FROM: "+from);    foreach(to, string t) -  cmd("RCPT TO:"+t); +  cmd("RCPT TO: "+t);    cmd("DATA");    cmd(body+"\r\n.");    cmd("QUIT");    }       void simple_mail(string to, string subject, string from, string msg)    {    send_message(from, ({ to }),    (string)MIME.Message(0, (["mime-version":"1.0",    "subject":subject,    "from":from,    "to":to]),    ({ MIME.Message(msg,    (["content-type":"text/plain;charset=iso-8859-1",    "content-transfer-encoding":"8bit"])) })));    }   }