资源简介
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个文件信息
相关资源
- 国密算法SM3_SM4.zip
- Java to C# Converter 破解版
- C#实现Java语言MD5withRSA/SHA256withRSA/SHA
- C#、C++、HTML5、JAVA、Python、数据结构与
- C# 制作的C/S Oracle 小型图书管理系统
- C#调用Java接口演示
- C#和java 之间基于Socket的通信
- java与C#的PBE加密
- C#调用JavaWebService(客户端)
- JavaMail帐号激活与忘记密码
- Java to C# Converter V2.9 破解版
- C# to Java 代码转换工具(已破解)
- java调用C#封装的dll(jnacom)
- java调用C#封装的dll方法
- C++、VB、DELPHI、JAVA、C#调用DLL
- c#调用次世代AntiVC.dll 完整 复杂验证码
- C#调用java做成的webservice
- JAVA调用C#的DLL文件
- Java调用C#DLL
- C# RSA加密、解密、加签、验签、支持
- .net与java中的互操作rsa签名与验签、加
- json转换成实体类工具优化版
- 固定资产管理系统开源
- c# winform 类似android toast消息功能
- 杨中科老师的全13季 .NET经典视频教程
- c++ AES 兼容 JAVA AES CBC PKCS5Padding C#
- SMTP和POP3的邮件客户端
-
NppAst
yle用于格式化Notepad中编辑的 - C#开发Android应用实战整本扫描版.pdf
- C# To JAVA Converter v17.10.6(最新破解版)
评论
共有 条评论