zoukankan      html  css  js  c++  java
  • 有参数的程序,可以被调用

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Forms;
    using System.IO;
    
    namespace SendMail
    {
        static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main(string[] Arrs)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
               //Application.Run(new Form1());
                if (Arrs == null) { WriteErr("No Parameter"); return; }
    
                string sfrom = "";
                string sto = "";
                string scc = "";
                string sbcc = "";
                string ssubject = "";
                string sbody = "";
                string satt = "";
                string[] Arr = Arrs[0].Split('|');
                if (Arr.Length > 0)
                    sfrom = Arr[0];
                if (Arr.Length > 1)
                    sto = Arr[1];
                if (Arr.Length > 2)
                    scc = Arr[2];
                if (Arr.Length > 3)
                    sbcc = Arr[3];
                if (Arr.Length > 4)
                    ssubject = Arr[4];
                if (Arr.Length > 5)
                    sbody = Arr[5];
                if (Arr.Length > 6)
                    satt = Arr[6];
                if (sfrom == "" || (sto == "" && scc == "")) { WriteErr("Parameter Error"); return; }
    
                SendMail.Mail SendMail = new SendMail.Mail();
                string Err = SendMail.SendMail(sfrom, sto, scc, sbcc, ssubject, sbody, satt);
                WriteErr(Err);
            }
    
            static void WriteErr(string strErr)
            {
                if (strErr == "") return;
                System.IO.StreamWriter sw;
                sw = new StreamWriter(Application.StartupPath + "\Error.err", false, System.Text.Encoding.Default);
                sw.WriteLine(strErr);
                sw.Flush();
                sw.Close();
            }
        }
    }
  • 相关阅读:
    27-Perl 进程管理
    26-Perl 包和模块
    25-Perl CGI编程
    YUM极速安装mariadb
    yum极速安装mysql5.7
    切换阿里yum镜像源
    mysql生成随机字符串函数
    Unable to locate value meta plugin of type (id)
    centos 挂载NTFS移动硬盘
    总有你要的编程书单(GitHub )
  • 原文地址:https://www.cnblogs.com/vinsonLu/p/3656994.html
Copyright © 2011-2022 走看看