当前位置:首页 » 编程博文
开发技术指南» 文章正文
    引言: using System;using System.Text;u
 

 

 ·unicode编码转化介绍    »显示摘要«
    摘要: 1 简介 1.1 目的 本文档介绍了在win32和linux等平台下的各种编码之间的转化方法。 1.2 概述 ansi c定义了统一的编码转化函数setlocale,mbstowcs,wcstombs,但这些函数在win32平台上实现了,却未在linux平台上实现,在linux平台上实现编码转化需要调用iconv_open, iconv, iconv_close函数。 2 win......
    摘要: sip gatewaysa sip gateway is an application that interfaces a sip network to a network utilizing another signaling protocol. in terms of the sip protocol, a gateway is just a special type of user age......


C#实现SMTP服务器,使用TCP命令实现,功能比较完善

using system; 【程序编程相关:常用JS函数

【推荐阅读:【收藏】C++模板元编程[metapro

using system.text; 【扩展信息:程序打包时的路径问题

using system.io;

using system.net;

using system.net.sockets;

using system.collections;

namespace skydev.web.mail

{

 public enum mailformat{text,html};

 public enum mailpriority{low=1,normal=3,high=5};

 #region class mailattachments

 public class mailattachments

 {

  private const int maxattachmentnum=10;

  private ilist _attachments;

  public mailattachments()

  {

   _attachments=new arraylist(); 

  }

  public string this[int index]

  {

   get { return (string)_attachments[index];}

  }

  /// <summary>

  /// 添加邮件附件

  /// </summary>

  /// <param name="filepath">附件的绝对路径</param>

  public void add(params string[] filepath)

  {

   if(filepath==null)

   {

    throw(new argumentnullexception("非法的附件"));

   }

   else

   {    

    for(int i=0;i<filepath.length;i++)

    {

     add(filepath[i]);

    }

   }

  }

  /// <summary>

  /// 添加一个附件,当指定的附件不存在时,忽略该附件,不产生异常.

  /// </summary>

  /// <param name="filepath">附件的绝对路径</param>

  public void add(string  filepath)

  {

   //当附件存在时才加入,否则忽略

   if (system.io.file.exists(filepath))

   {

    if (_attachments.count<maxattachmentnum)

    {

     _attachments.add(filepath);

    }

   }

  }

  public void clear()//清除所有附件

  {

   _attachments.clear();

  }

  public int count//获取附件个数

  {

   get { return _attachments.count;}

  }

 }

 #endregion//end class mailattachments

 

 #region class mailmessage

 /// <summary>

 /// mailmessage 表示smtp要发送的一封邮件的消息.

 /// </summary>

 public class mailmessage

 {

  private const int maxrecipientnum=10;

  public mailmessage()

  {   

   _recipients=new arraylist();//收件人列表

   _attachments=new mailattachments();//附件

   _bodyformat=mailformat.text;//缺省的邮件格式为text

   _priority=mailpriority.normal;

   _charset="gb2312";

  }

  /// <summary>

  /// 设定语言代码,默认设定为gb2312,如不需要可设置为""

  /// </summary>

  public string charset

  {

   get { return _charset;}

   set { _charset=value;}

  }

  public string from

  {

   get{ return _from;}

   set { _from=value;}

  }

  public string fromname

  {

   get { return _fromname;}

   set { _fromname=value;}

  }

  public string body

  {

   get { return _body;}

   set { _body=value;}

  }

  public string subject

  {

   get { return _subject;}

   set { _subject=value;}

  }

  public mailattachments attachments

  {

   get {return _attachments;}

   set { _attachments=value;}

  }

  public mailpriority priority

  {

   get { return _priority;}

   set { _priority=value;}

  }

  public ilist recipients

  {

   get { return _recipients;}

  }


...   下一页
 ·例子:sip通过网关的呼叫pstn    »显示摘要«
    摘要:sip to pstn call through gateway in the example shown in , the calling sip phone places a telephone call to the pstn through a pstn gateway. the sip phone collects the dialed digits and puts them int......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE