asp.net 建立pop3邮箱

xuan.ye 2009-03-21 03:05:44
asp.net 建立pop3邮箱


...全文
216 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
-叶子- 2009-03-23
  • 打赏
  • 举报
回复
我是来学习的
lookauto 2009-03-23
  • 打赏
  • 举报
回复
不会回答 过来帮你顶 一下 呵呵
xuan.ye 2009-03-23
  • 打赏
  • 举报
回复
up
liuyeede 2009-03-21
  • 打赏
  • 举报
回复
Lumisoft.net 邮件服务器软件中应该有用户注册的实现。
jscn123789abc 2009-03-21
  • 打赏
  • 举报
回复
帮顶。。。
gui0605 2009-03-21
  • 打赏
  • 举报
回复
这个~~没搞过,静待留下高人
xuan.ye 2009-03-21
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 liuyeede 的回复:]
也就是提供邮件用户注册的代码吧?
[/Quote]

呵呵,太多了
liuyeede 2009-03-21
  • 打赏
  • 举报
回复
也就是提供邮件用户注册的代码吧?
xuan.ye 2009-03-21
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 liuyeede 的回复:]
是要通过代码创建Pop3邮箱?
[/Quote]
是的
hanyucq123 2009-03-21
  • 打赏
  • 举报
回复
先安装jmail,再引用jmail
然后用如下代码就OK
using System;
using jmail;

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MessageClass message = new MessageClass();

message.Charset = "gb2312";

message.From = "xxxx@163.com"; //发件人地址

message.Subject = "Jmail使用……"; //标题

message.HTMLBody = "<strong style=\"color:#ff3300\">自己弄的邮件发送系统,测试一下!!</strong>";

message.MailServerUserName = "xxxx"; //邮件服务器用户名(即邮件用户名)

message.MailServerPassWord = "*******"; //邮件服务器密码

message.AddRecipient("xxx@qq.com", "", ""); //收件人地址

message.Send("smtp.163.com", false); //SMTP服务器地址

Response.Write("JMAIL发送成功!");

}
}
liuyeede 2009-03-21
  • 打赏
  • 举报
回复
是要通过代码创建Pop3邮箱?
xuan.ye 2009-03-21
  • 打赏
  • 举报
回复
谢谢楼上几位了
但是我问的不是这个问题啊


问题是建立pop3邮箱
chouto 2009-03-21
  • 打赏
  • 举报
回复
学习下,呵呵
叶子 2009-03-21
  • 打赏
  • 举报
回复
发送邮件我一般使用jmail
叶子 2009-03-21
  • 打赏
  • 举报
回复

public bool sendMail()
{
MessageClass email = new MessageClass();
email.Logging = true;
email.Silent = true;
email.MailServerUserName = "abcdef@163.com";
email.MailServerPassWord = "124";
email.From = "abcdef@163.com";
email.Subject = "jmail";
email.AddAttachment("c:\\test.xml",true,"");
email.Body = "test jmail send mail";
email.AddRecipient("abcdef@163.com", "abc", null);
return email.Send("mail.163.com", false)
}
liuyeede 2009-03-21
  • 打赏
  • 举报
回复
也可使用LumiSoft.Net.POP3.Client类完成上述类的功能(推荐使用)
liuyeede 2009-03-21
  • 打赏
  • 举报
回复
    public class Pop3Helper
{
string _pop3server;
string _user;
int _port;
string _pwd;
public TcpClient _server;
public NetworkStream _netStream;
public StreamReader _reader;
public string _data;
public byte[] _charData;
public string _CRLF = "\r\n";
private string _log;
public string LogMSG
{
get { return _log; }
}
/// <summary>
///
/// </summary>
/// <param name="server"></param>
/// <param name="port"></param>
/// <param name="user"></param>
/// <param name="pwd"></param>
public Pop3Helper(string server, int port, string user, string pwd)
{
_pop3server = server;
_port = port;
_user = user;
_pwd = pwd;
}
/// <summary>
/// connect
/// </summary>
public void Connect()
{
//create a tcp connection
_server = new TcpClient(_pop3server, _port);
//prepare
_netStream = _server.GetStream();
_reader = new StreamReader(_server.GetStream());
if (!CheckResult(_reader.ReadLine()))
throw new Exception("Connect Error");
//login
_data = "USER " + this._user + _CRLF;
_charData = System.Text.Encoding.ASCII.GetBytes(_data.ToCharArray());
_netStream.Write(_charData, 0, _charData.Length);
if (!CheckResult(_reader.ReadLine()))
throw new Exception("User Error");
_data = "PASS " + this._pwd + _CRLF;
_charData = System.Text.Encoding.ASCII.GetBytes(_data.ToCharArray());
_netStream.Write(_charData, 0, _charData.Length);
if (!CheckResult(_reader.ReadLine()))
throw new Exception("Pass Error");
}
/// <summary>
/// get message Numbers
/// </summary>
/// <returns></returns>
public int GetMailCount()
{
try
{
_data = "STAT" + _CRLF;
_charData = System.Text.Encoding.ASCII.GetBytes(_data.ToCharArray());
_netStream.Write(_charData, 0, _charData.Length);
string resp = _reader.ReadLine();
string[] tokens = resp.Split(new char[] { ' ' });
return Convert.ToInt32(tokens[1]);
}
catch (Exception ex)
{
return 0;
}
}
public string GetMail(int id)
{
string line;
string content = "";
try
{
//get by id
_data = "RETR " + id + _CRLF;
_charData = System.Text.Encoding.ASCII.GetBytes(_data.ToCharArray());
_netStream.Write(_charData, 0, _charData.Length);
line = _reader.ReadLine();
if (line[0] != '-')
{
//end with '.'
while (line != ".")
{
line = _reader.ReadLine();
content += line + "\r\n";
}
}

return content;
}
catch (Exception err)
{
Log(err.Message);
return "Error";
}
}
public void DeleteMail(int id)
{
_data = "DELE" + id + _CRLF;
_charData = System.Text.Encoding.ASCII.GetBytes(_data.ToCharArray());
_netStream.Write(_charData, 0, _charData.Length);
if (!CheckResult(_reader.ReadLine()))
throw new Exception("Delete Error");
}
/// <summary>
/// close connection
/// </summary>
public void Close()
{
_data = "QUIT" + _CRLF;
_charData = System.Text.Encoding.ASCII.GetBytes(_data.ToCharArray());
_netStream.Write(_charData, 0, _charData.Length);
//close
_netStream.Close();
_reader.Close();
}
private bool CheckResult(string reply)
{
Log(reply);
if (reply.IndexOf("+OK") > -1)
return true;
else
return false;
}
private void Log(string msg)
{
_log += msg + "\r\n";
}
}
ws_hgo 2009-03-21
  • 打赏
  • 举报
回复
关注..
Sakeyi 2009-03-21
  • 打赏
  • 举报
回复
还没用过此类技术,帮顶.
pgameli 2009-03-21
  • 打赏
  • 举报
回复
sf 帮顶

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧