资源简介
C#语言的邮件收发系统,C#对网络编程的支持不太好,建议使用Java语言开发,该程序功能不是很强大,因此只建议学POP3和SMTP协议的新手看就行了。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Collections;
using System.Data.OleDb;
namespace MailSendOfRecive
{
public partial class Form1 : Form
{
TcpClient smtpSrv;
NetworkStream netStm;
string CRLF = “\r\n“;
public List SMail = new List();
public Form2 fa;
public string Ua Pw Sv;
public Form1(Form2 fstring UNstring Pdstring SR)
{
fa = f;
Ua = UN;
Pw = Pd;
Sv = SR;
InitializeComponent();
}
public void WriteStream(string strCmd)
{
strCmd += CRLF; //crlf表示结束
byte[] bw = System.Text.Encoding.Default.GetBytes(strCmd); //将字符串转为字节数组
netStm.Write(bw0bw.Length); //写入网络
}
private string AuthStream(string strCmd) //连接服务器输出字符串
{
try
{
byte[] by = System.Text.Encoding.Default.GetBytes(strCmd);
strCmd = Convert.Tobase64String(by); //转换成base64编码
}
catch (System.Exception ex)
{
return ex.ToString();
}
return strCmd;
}
public bool tryTran( ref string a)
{
string b = ““;
b = a;
try
{
byte[] outputb = Convert.Frombase64String(a);
a = Encoding.Default.GetString(outputb);
return true;
}
catch (System.Exception ex)
{
a= b;
return false;
}
}
public void WritInf(string s)
{
tryTran(ref s);
listBoxMsg.Items.Add(s);
}
private void ButtonSend_Click(object sender EventArgs e)
{
listBoxMsg.Items.Clear(); //存放smtp服务器返回的信息
//string SenIndo;
try
{
string data;
progressBar1.Visible = true;
progressBar1.Value = 1;
smtpSrv = new TcpClient(“smtp.“+Sv25);//TextBoxSer.Text25); //连接smtp服务器
netStm = smtpSrv.GetStream(); //取得Networkstream对象来发送接收数据
StreamReader rdStrm = new StreamReader(smtpSrv.GetStream());//产生StreamReader来读取数据流
//SenIndo = “EHLO Local“; //+ TextBoxUser.Text;
WriteStream(“EHLO Local“); //发送命令建立连接
//string s = rdStrm.ReadLine();
WritInf(rdStrm.ReadLine());
WritInf(rdStrm.ReadLine());
WritInf(rdStrm.ReadLine());
WritInf(rdStrm.ReadLine())
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 27136 2013-10-11 10:22 MailSendOfRecive\MailSendOfRecive\bin\Debug\MailSendOfRecive.exe
文件 54784 2013-10-11 10:22 MailSendOfRecive\MailSendOfRecive\bin\Debug\MailSendOfRecive.pdb
文件 14328 2013-10-11 10:24 MailSendOfRecive\MailSendOfRecive\bin\Debug\MailSendOfRecive.vshost.exe
文件 490 2009-06-11 05:14 MailSendOfRecive\MailSendOfRecive\bin\Debug\MailSendOfRecive.vshost.exe.manifest
文件 7045 2013-05-28 03:41 MailSendOfRecive\MailSendOfRecive\Form1.cs
文件 7964 2013-05-28 03:29 MailSendOfRecive\MailSendOfRecive\Form1.Designer.cs
文件 5814 2013-05-28 03:29 MailSendOfRecive\MailSendOfRecive\Form1.resx
文件 18881 2013-10-11 11:49 MailSendOfRecive\MailSendOfRecive\Form2.cs
文件 9565 2013-10-10 16:09 MailSendOfRecive\MailSendOfRecive\Form2.Designer.cs
文件 5814 2013-10-10 15:45 MailSendOfRecive\MailSendOfRecive\Form2.resx
文件 2394 2013-05-28 00:58 MailSendOfRecive\MailSendOfRecive\Form3.cs
文件 5166 2013-05-28 00:10 MailSendOfRecive\MailSendOfRecive\Form3.Designer.cs
文件 5814 2013-05-28 00:10 MailSendOfRecive\MailSendOfRecive\Form3.resx
文件 4351 2013-05-27 19:02 MailSendOfRecive\MailSendOfRecive\MailSendOfRecive.csproj
文件 1259 2013-10-11 10:24 MailSendOfRecive\MailSendOfRecive\obj\Debug\MailSendOfRecive.csproj.FileListAbsolute.txt
文件 963 2013-10-10 15:48 MailSendOfRecive\MailSendOfRecive\obj\Debug\MailSendOfRecive.csproj.GenerateResource.Cache
文件 27136 2013-10-11 10:22 MailSendOfRecive\MailSendOfRecive\obj\Debug\MailSendOfRecive.exe
文件 180 2013-09-17 15:25 MailSendOfRecive\MailSendOfRecive\obj\Debug\MailSendOfRecive.Form1.resources
文件 180 2013-10-10 15:48 MailSendOfRecive\MailSendOfRecive\obj\Debug\MailSendOfRecive.Form2.resources
文件 180 2013-09-17 15:25 MailSendOfRecive\MailSendOfRecive\obj\Debug\MailSendOfRecive.Form3.resources
文件 54784 2013-10-11 10:22 MailSendOfRecive\MailSendOfRecive\obj\Debug\MailSendOfRecive.pdb
文件 180 2013-09-17 15:25 MailSendOfRecive\MailSendOfRecive\obj\Debug\MailSendOfRecive.Properties.Resources.resources
文件 497 2013-05-27 23:21 MailSendOfRecive\MailSendOfRecive\Program.cs
文件 1394 2013-05-26 10:23 MailSendOfRecive\MailSendOfRecive\Properties\AssemblyInfo.cs
文件 2882 2013-05-26 10:23 MailSendOfRecive\MailSendOfRecive\Properties\Resources.Designer.cs
文件 5612 2013-05-26 10:23 MailSendOfRecive\MailSendOfRecive\Properties\Resources.resx
文件 1101 2013-05-26 10:23 MailSendOfRecive\MailSendOfRecive\Properties\Settings.Designer.cs
文件 249 2013-05-26 10:23 MailSendOfRecive\MailSendOfRecive\Properties\Settings.settings
文件 938 2013-05-26 10:23 MailSendOfRecive\MailSendOfRecive.sln
..A..H. 25088 2013-10-11 11:49 MailSendOfRecive\MailSendOfRecive.suo
............此处省略12个文件信息
相关资源
- C#和Java实现互通的RSADES加解密算法
- 寿星万年历C#版bug修正
- JSP项目技术源代码(15个项目)
- C#写的医院挂号信息管理系统
- C# [分享] 写给心爱的女孩的一个漂亮
- RSA算法JAVA公钥加密,C#私钥解密
- Introduction to Neural Networks
- .proto 各种语言转换
- .NET C#利用ZXing生成、识别二维码/条形
- java网站后台管理系统源码
- 数据结构与算法:C#语言描述(中,英
- Protocbuf2.5,windows已经编译版本protoc
- C#开发Android应用程序(连接SQL Server)
- C#培训全套资源讲师:周红安
- Android应用源码安卓与PC的Socket通信项
- CTP接口c/C#/jAVA/MATLAB
- C# RSA加密、支持JAVA格式公钥私钥
- Android studio3.0.1; vs2013 ; 调用C#写的We
- C# 实现的 Android ADB工具
- 西电计算机数据库上机作业_2016级SQ
- itextsharp5.5.10源代码
- 第三方登录[含QQ、微信、新浪微博]
- JAVA通过JNI调用C#dll的整个项目工程
- C#调用java直接调用无需生成.net组件
- AntiSamy Xss跨站脚本攻击WebService War包
- SM4加密C#类
- android 访问c# webservice 实现登陆注册功
- 《Visual+C#+2010从入门到精通》全部源码
- ACCP8.0所有课件以及源码
- Android 邮箱源码
评论
共有 条评论