コード例 #1
0
        static int Main(string[] args)
        {
            System.Environment.ExitCode = System.Environment.ExitCode = (int)ExitCode.Fail;;

            arguments             = args;
            TextlogOutput.enabled = !(getOptionalParam("-logfile", "").Equals(""));
            TextlogOutput.logFile = getOptionalParam("-logfile", "senditquiet.log");

            SendMailConfiguration conf = new SendMailConfiguration();

            conf.Host       = getRequiredParam("-s");
            conf.Port       = int.Parse(getOptionalParam("-port", "25"));
            conf.Pwd        = getRequiredParam("-p");
            conf.Recipient  = getRequiredParam("-t");
            conf.SenderMail = getRequiredParam("-f");
            conf.SslEnabled = getOptionalParam("-protocol", "normal").Equals("ssl");
            conf.UserName   = getRequiredParam("-u");
            conf.Subject    = getOptionalParam("-subject", "A mail, sent by using senditquite");
            conf.Cc         = getOptionalParam("-cc", "");
            conf.Bcc        = getOptionalParam("-bcc", "");
            SendMail.getInstance().setConfiguration(conf);
            try
            {
                string body = getMessageBod();

                SendMail.getInstance().sendMail(conf.Subject, body, getOptionalParam("-files", "").Split(';'));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Trace.TraceError(e.Message);
                Trace.TraceError(e.StackTrace);
            }

            return(System.Environment.ExitCode);
        }
コード例 #2
0
 internal static SendMail getInstance()
 {
     return(instance != null ? instance : instance = new SendMail());
 }