|
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();
}
}
}
|
|
|