登录
首页 » C#源码 » C#邮件收发程序 发Email和接收邮件

C#邮件收发程序 发Email和接收邮件

于 2022-04-23 发布 文件大小:288.40 kB
0 160
下载积分: 2 下载次数: 1

代码说明:

C#实现的一个邮件收发程序,功能主要是两大块,发送邮件和接收邮件,类似于一个邮件客户端的功能,在这个邮件发送程序中,写了几个函数分别实现相关的模块功能:   对获得连接的用户身份进行验证   获取登录邮箱的各种信息   判断返回的字符串信息,如果是“+OK”,证明登录成功,否则登录失败   根据输入的邮件编号读取邮件信息   获取由参数标识的邮件的全部文本   对读取的邮件内容进行Base64编码   “登录”按钮事件,实例化SmtpClient邮件发送类对象   初始化StreamReader对象,以便以流的形式读取远程主机中的内容   获取远程主机中指定用户的邮件信息   获得远程主机上指定邮件的相关信息,存储到一个string类型的数组中,数组中的内容包括:邮件日期、发信人、收信人、邮件主题、邮件内容等。

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • C# 输入界面中的各种文本框判断效果演示
    这是一个实用的输入判断验证演示程序,面向C#编程环境,当用户输入的数据不正确或为空时,均会显示提示,不过这个提示是一个图标在闪烁,直到输入正确,下面是判断机制:   private void textBox2_Validating(object sender, System.ComponentModel.CancelEventArgs e)   {    if (textBox2.Text == "")//判断是否输入订货数量    {    errorProvider2.SetError(textBox2, "不能为空");//设置errorProvider2的错误提示    }    else    {    try    {    int x = Int32.Parse(textBox2.Text);//判断是否输入数字,如果不是数字会出现异常    errorProvider2.SetError(textBox2, "");// errorProvider2控件不显示任何错误信息    b = 1;//将b赋值为1    }    catch    {    //如果出现异常,设置errorProvider2控件的错误信息    errorProvider2.SetError(textBox2, "请输入一个数");    }    }   }   private void textBox3_Validating(object sender, System.ComponentModel.CancelEventArgs e)   {    if (textBox3.Text == "")//判断是否输入订货数量    {    errorProvider3.SetError(textBox3, "不能为空");//设置errorProvider3显示的错误消息    }    else    {    errorProvider3.SetError(textBox
    2022-01-25 17:43:07下载
    积分:1
  • C# 在LINQ to DataSet中对分组操作执行子查询
    C# 在LINQ to DataSet中对分组操作执行子查询,相关代码:   private void button1_Click(object sender, EventArgs e)   {//在LINQ to DataSet中对分组操作执行子查询    SqlConnection MyConnection = new SqlConnection();    MyConnection.ConnectionString = @"Data Source =.SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True";    MyConnection.Open();    SqlCommand MyCommand = new SqlCommand("Select * From Orders ", MyConnection);    DataSet MySet = new DataSet();    SqlDataAdapter MyAdapter = new SqlDataAdapter(MyCommand);    MyAdapter.Fill(MySet);    DataTable MyQueryTable = MySet.Tables[0];    var MyQuery = from MyOrder in MyQueryTable.AsEnumerable()    orderby MyOrder.Field("ShipCity")    group MyOrder by MyOrder.Field("ShipCity") into g    select new    {    MyCity = g.Key,    MyMaxFreight = (from MyData in g select MyData.Field("Freight")).Max()   
    2022-01-27 20:20:32下载
    积分:1
  • 7Zip
    This file is part of SevenZipSharp.    SevenZipSharp is free software: you can redistribute it and/or modify    it under the terms of the GNU Lesser General Public License as published by    the Free Software Foundation, either version 3 of the License, or    (at your option) any later version.    SevenZipSharp is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public License    along with SevenZipSharp.  If not, see .
    2022-07-20 00:09:31下载
    积分:1
  • C# 在LINQ to XML中将XML文件转换为CSV文件的例子
    C# 在LINQ to XML中将XML文件转换为CSV文件的例子源码,转换的结果请参考如图所示:   private void button1_Click(object sender, EventArgs e)   {//在LINQ to XML中将XML文件转换为CSV文件    TextReader MyReader = new StringReader(this.textBox1.Text);    XElement MyCustomers= XElement.Load(MyReader);    MyReader.Close();    string MyInfo =    (from MyElement in MyCustomers.Elements("客户")    select    String.Format("{0},{1},{2},{3},{4}",    (string)MyElement.Element("客户ID"),    (string)MyElement.Element("公司名称"),    (string)MyElement.Element("城市") + (string)MyElement.Element("地址"),    (string)MyElement.Element("联系人姓名"),    Environment.NewLine    )    ).Take(10).Aggregate(new StringBuilder(),(MySubString, MyString)=>MySubString.Append(MyString),MySubString=>MySubString.ToString());    MessageBox.Show(MyInfo, "信息提示");   }
    2023-04-08 15:00:04下载
    积分:1
  • C# 把Excel数据读入ListView
    Visual 编写实现的Excel文件阅读器,把Excel数据读入ListView,这个程序是调用到一些Excel操作类,看 Excel Application 对象是否已经成功生成,打开文件对话框(openfiledialog)只显示Excel文件,调用Open方法打开Excel工作簿,还牵涉到把二维的数组转化为一维的字符串数组,核心代码部分,请参考以下代码:   // 调用Open方法打开Excel工作簿,多数使用缺省值 (除了 read-only我们设置它为 true)   Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open(openFileDialog1.FileName, 0, true, 5,"", "", true, Excel.XlPlatform.xlWindows, " ", false, false, 0, true);   // 取得工作簿(workbook)中表单的集合(sheets)   Excel.Sheets sheets = theWorkbook.Worksheets;   // 取得表单集合中唯一的一个表(worksheet)   Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1);   // 读取前10行,置入listview   for (int i = 1; i
    2022-11-07 08:15:04下载
    积分:1
  • C# WPF 使用几何路径实现动画旋转按钮
    Visual C# 使用几何路径来实现动画效果的旋转按钮,这是一个wpf类型的C#实例,运行Bin目录下的exe文件,你会发现整个按钮会在窗体的范围内沿预先设定好的几何路径来运动,就像过山车一样,按钮的方向和按钮文字的方向同时发生改变,正在运动中的按钮效果,请参见截图所示。
    2022-05-22 01:33:58下载
    积分:1
  • C# 为DataGridView控件设置交替行样式(隔行换色)
    C# 为DataGridView控件设置交替行样式,也就是大家熟悉的隔行换色功能,每一行数据的底色都不一样,这样可更清淅的浏览表格,在WEB开发中,这也是一个受欢迎的功能,在C# WinForm编程中,同样是个既实用又美观的功能。   本示例测试需要连接好SQL数据库,否则DataGridView未填充数据,不能看出多行隔行换色效果。其实实现这一功能,最核心的几行代码如下:   为DataGridView控件设置交替行样式   this.customersDataGridView.RowsDefaultCellStyle.BackColor = Color.SeaGreen ;   this.customersDataGridView.AlternatingRowsDefaultCellStyle.BackColor =Color.Cyan;
    2022-11-20 06:00:03下载
    积分:1
  • C# 根据文件名提取文件类型图标
    C# 根据文件名提取文件类型图标,设定好文件目录后,本例中是读取C:Windows下的所有文件,并根据文件类型自动显示图标,如测试图所示,将文件类型的图标添加到listView中,下面是具体的实现代码:   this.imageList1.Images.Clear();   this.listView1.Items.Clear();    string MyFolder = @"C:Windows";   DirectoryInfo MyDir = new DirectoryInfo(MyFolder);   ListViewItem MyItem;   this.listView1.BeginUpdate();   foreach (FileInfo MyFile in MyDir.GetFiles())   {    Icon MyIcon = SystemIcons.WinLogo;    MyItem = new ListViewItem(MyFile.Name, 1);    MyIcon = Icon.ExtractAssociatedIcon(MyFile.FullName);    if (!this.imageList1.Images.ContainsKey(MyFile.Extension))    {    MyIcon =Icon.ExtractAssociatedIcon(MyFile.FullName);    this.imageList1.Images.Add(MyFile.Extension, MyIcon);    }    MyItem.ImageKey = MyFile.Extension;    this.listView1.Items.Add(MyItem);   }
    2023-07-30 19:25:04下载
    积分:1
  • activeMQ C++
    activeMQ C++源码 ,C++写的源代码,网上找到的,分享给大家。
    2022-09-14 21:05:04下载
    积分:1
  • C# 获取本地打印服务器后台文件的路径
    Visual C# MyWinWPF.rar,核心代码分享如下:   private void button1_Click(object sender, RoutedEventArgs e)   {//获取本地打印服务器后台文件的路径    var MyPrintServer = new System.Printing.LocalPrintServer();    string MyInfo = "本地打印服务器后台文件的路径是:" + MyPrintServer.DefaultSpoolDirectory;    MessageBox.Show(MyInfo, "信息提示", MessageBoxButton.OK);   }
    2022-01-23 11:13:33下载
    积分:1
  • 696516资源总数
  • 106648会员总数
  • 8今日下载