当前位置: 首页>>代码示例>>C#>>正文


C# MIME.MIME_Encoding_EncodedWord类代码示例

本文整理汇总了C#中LumiSoft.Net.MIME.MIME_Encoding_EncodedWord的典型用法代码示例。如果您正苦于以下问题:C# MIME_Encoding_EncodedWord类的具体用法?C# MIME_Encoding_EncodedWord怎么用?C# MIME_Encoding_EncodedWord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MIME_Encoding_EncodedWord类属于LumiSoft.Net.MIME命名空间,在下文中一共展示了MIME_Encoding_EncodedWord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendMail

        //public MailMessage GenMail(string mailSubject)
        //{
        //    // 生成邮件
        //    MailMessage message = new MailMessage("[email protected]", "[email protected]");
        //    message.Sender = new MailAddress("[email protected]");
        //    message.Subject = mailSubject;
        //    message.Body = "[email protected]" + " Send " + mailSubject;
        //    message.Priority = MailPriority.High;
        //    return message;
        //}
        public int SendMail(MailAccount Sender, MailAccount Receiver, string mailSubject)
        {
            Mail_Message msg = Create_PlainText_Html_Attachment_Image(Receiver.UserName, Sender.MailAddress, Sender.UserName);
            MemoryStream m = new MemoryStream();
            MIME_Encoding_EncodedWord ew = new MIME_Encoding_EncodedWord(MIME_EncodedWordEncoding.B, Encoding.UTF8);
            msg.ToStream(m, ew, Encoding.UTF8, false);
            m.Position = 0;

            LumiSoft.Net.SMTP.Client.SMTP_Client smtpClient;

            smtpClient = new LumiSoft.Net.SMTP.Client.SMTP_Client();

            try
            {
                smtpClient.Connect(Sender.SmtpHost, Sender.SendPort, Sender.SendSsl);
                try
                {
                    smtpClient.EhloHelo(Sender.SmtpHost);
                    smtpClient.Authenticate(Sender.UserName, Sender.Password);
                    smtpClient.MailFrom(Sender.UserName, -1);
                    smtpClient.RcptTo(Receiver.UserName);
                    smtpClient.SendMessage(m);
                }
                finally
                {
                    smtpClient.Disconnect();
                }
            }
            finally
            {
                smtpClient = null;
            }
            return 0;
        }
开发者ID:unicloud,项目名称:AFRP,代码行数:44,代码来源:SendMailLumiSoft.cs

示例2: ToStream

        /// <summary>
        /// Stores MIME entity body to the specified stream.
        /// </summary>
        /// <param name="stream">Stream where to store body data.</param>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified, 
        /// original encoding is kept.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stream</b> is null reference.</exception>
        internal protected override void ToStream(Stream stream,MIME_Encoding_EncodedWord headerWordEncoder,Encoding headerParmetersCharset,bool headerReencode)
        {
            if(stream == null){
                throw new ArgumentNullException("stream");
            }

            Net_Utils.StreamCopy(GetEncodedDataStream(),stream,32000);
        }
开发者ID:CivilPol,项目名称:LumiSoft.Net,代码行数:17,代码来源:MIME_b_SinglepartBase.cs

示例3: ToStream

        /// <summary>
        /// Stores MIME entity body to the specified stream.
        /// </summary>
        /// <param name="stream">Stream where to store body data.</param>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified, 
        /// original encoding is kept.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stream</b> is null reference.</exception>
        protected internal override void ToStream(Stream stream,MIME_Encoding_EncodedWord headerWordEncoder,Encoding headerParmetersCharset,bool headerReencode)
        {
            if(stream == null){
                throw new ArgumentNullException("stream");
            }

            m_pMessage.ToStream(stream,headerWordEncoder,headerParmetersCharset,headerReencode);
        }
开发者ID:ChuckLafferty,项目名称:bugnet,代码行数:17,代码来源:MIME_b_MessageRfc822.cs

示例4: ToString

 /// <summary>
 /// Returns header field as string.
 /// </summary>
 /// <param name="wordEncoder">8-bit words ecnoder. Value null means that words are not encoded.</param>
 /// <param name="parmetersCharset">Charset to use to encode 8-bit characters. Value null means parameters not encoded.</param>
 /// <param name="reEncode">If true always specified encoding is used. If false and header field value not modified, original encoding is kept.</param>
 /// <returns>Returns header field as string.</returns>
 public override string ToString(MIME_Encoding_EncodedWord wordEncoder,Encoding parmetersCharset,bool reEncode)
 {
     if(string.IsNullOrEmpty(m_Address)){
         return "Return-Path: <>\r\n";
     }
     else{
         return "Return-Path: <" + m_Address + ">\r\n";
     }
 }
开发者ID:CivilPol,项目名称:LumiSoft.Net,代码行数:16,代码来源:Mail_h_ReturnPath.cs

示例5: ToFile

        /// <summary>
        /// Stores MIME entity to the specified file.
        /// </summary>
        /// <param name="file">File name with path where to store MIME entity.</param>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified, 
        /// original encoding is kept.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>file</b> is null.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid value.</exception>
        public void ToFile(string file,MIME_Encoding_EncodedWord headerWordEncoder,Encoding headerParmetersCharset,bool headerReencode)
        {
            if(file == null){
                throw new ArgumentNullException("file");
            }
            if(file == ""){
                throw new ArgumentException("Argument 'file' value must be specified.");
            }

            using(FileStream fs = File.Create(file)){
                ToStream(fs,headerWordEncoder,headerParmetersCharset,headerReencode);
            }
        }
开发者ID:dioptre,项目名称:nkd,代码行数:23,代码来源:MIME_Entity.cs

示例6: ToString

 /// <summary>
 /// Returns address as string value.
 /// </summary>
 /// <param name="wordEncoder">8-bit words ecnoder. Value null means that words are not encoded.</param>
 /// <returns>Returns address as string value.</returns>
 public override string ToString(MIME_Encoding_EncodedWord wordEncoder)
 {
     if(string.IsNullOrEmpty(m_DisplayName)){
         return "<" + m_Address + ">";
     }
     else{
         if(MIME_Encoding_EncodedWord.MustEncode(m_DisplayName)){
             return wordEncoder.Encode(m_DisplayName) + " " + "<" + m_Address + ">";
         }
         else{
             return TextUtils.QuoteString(m_DisplayName) + " " + "<" + m_Address + ">";
         }
     }
 }
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:19,代码来源:Mail_t_Mailbox.cs

示例7: ToString

        /// <summary>
        /// Returns address as string value.
        /// </summary>
        /// <param name="wordEncoder">8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <returns>Returns address as string value.</returns>
        public override string ToString(MIME_Encoding_EncodedWord wordEncoder)
        {
            StringBuilder retVal = new StringBuilder();
            if(string.IsNullOrEmpty(m_DisplayName)){
                retVal.Append(":");
            }
            else{
                if(MIME_Encoding_EncodedWord.MustEncode(m_DisplayName)){
                    retVal.Append(wordEncoder.Encode(m_DisplayName) + ":");
                }
                else{
                    retVal.Append(TextUtils.QuoteString(m_DisplayName) + ":");
                }
            }
            for(int i=0;i<m_pList.Count;i++){
                retVal.Append(m_pList[i].ToString(wordEncoder));
                if(i < (m_pList.Count - 1)){
                    retVal.Append(",");
                }
            }
            retVal.Append(";");

            return retVal.ToString();
        }
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:29,代码来源:Mail_t_Group.cs

示例8: ConstructAddress

		/// <summary>
		/// Constructs ENVELOPE address structure.
		/// </summary>
		/// <param name="address">Mailbox address.</param>
        /// <param name="wordEncoder">Unicode words encoder.</param>
		/// <returns></returns>
		private static string ConstructAddress(Mail_t_Mailbox address,MIME_Encoding_EncodedWord wordEncoder)
		{
			/* An address structure is a parenthesized list that describes an
			   electronic mail address.  The fields of an address structure
			   are in the following order: personal name, [SMTP]
			   at-domain-list (source route), mailbox name, and host name.
			*/

			// NOTE: all header fields and parameters must in ENCODED form !!!

			StringBuilder retVal = new StringBuilder();
			retVal.Append("(");

			// personal name
            if(address.DisplayName != null){
			    retVal.Append(TextUtils.QuoteString(wordEncoder.Encode(RemoveCrlf(address.DisplayName))));
            }
            else{
                retVal.Append("NIL");
            }

			// source route, always NIL (not used nowdays)
			retVal.Append(" NIL");

			// mailbox name
			retVal.Append(" " + TextUtils.QuoteString(wordEncoder.Encode(RemoveCrlf(address.LocalPart))));

			// host name
            if(address.Domain != null){
			    retVal.Append(" " + TextUtils.QuoteString(wordEncoder.Encode(RemoveCrlf(address.Domain))));
            }
            else{
                retVal.Append(" NIL");
            }

			retVal.Append(")");

			return retVal.ToString();
		}
开发者ID:DJGosnell,项目名称:LumiSoft.Net,代码行数:45,代码来源:IMAP_t_Fetch_r_i_Envelope.cs

示例9: ConstructAddresses

		/// <summary>
		/// Constructs ENVELOPE addresses structure.
		/// </summary>
		/// <param name="mailboxes">Mailboxes.</param>
        /// <param name="wordEncoder">Unicode words encoder.</param>
		/// <returns></returns>
		private static string ConstructAddresses(Mail_t_Mailbox[] mailboxes,MIME_Encoding_EncodedWord wordEncoder)
		{
			StringBuilder retVal = new StringBuilder();
			retVal.Append("(");

			foreach(Mail_t_Mailbox address in mailboxes){                
				retVal.Append(ConstructAddress(address,wordEncoder));
			}

			retVal.Append(")");

			return retVal.ToString();
		}
开发者ID:DJGosnell,项目名称:LumiSoft.Net,代码行数:19,代码来源:IMAP_t_Fetch_r_i_Envelope.cs

示例10: ToStream

        /// <summary>
        /// Stores MIME entity body to the specified stream.
        /// </summary>
        /// <param name="stream">Stream where to store body data.</param>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified, 
        /// original encoding is kept.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stream</b> is null reference.</exception>
        internal protected override void ToStream(Stream stream,MIME_Encoding_EncodedWord headerWordEncoder,Encoding headerParmetersCharset,bool headerReencode)
        {
            if(stream == null){
                throw new ArgumentNullException("stream");
            }

            /* RFC 2046 5.1.1.
                NOTE:  The CRLF preceding the boundary delimiter line is conceptually
                attached to the boundary so that it is possible to have a part that
                does not end with a CRLF (line  break). 
            
                dash-boundary := "--" boundary
                 
                multipart-body := [preamble CRLF]
                                  dash-boundary transport-padding CRLF
                                  body-part *encapsulation
                                  close-delimiter transport-padding
                                  [CRLF epilogue]
                 
                encapsulation := delimiter transport-padding
                                 CRLF body-part

                delimiter := CRLF dash-boundary

                close-delimiter := delimiter "--"
            */

            // Set "preamble" text if any.
            if(!string.IsNullOrEmpty(m_TextPreamble)){
                if(m_TextPreamble.EndsWith("\r\n")){
                    byte[] preableBytes = Encoding.UTF8.GetBytes(m_TextPreamble);
                    stream.Write(preableBytes,0,preableBytes.Length);
                }
                else{
                    byte[] preableBytes = Encoding.UTF8.GetBytes(m_TextPreamble + "\r\n");
                    stream.Write(preableBytes,0,preableBytes.Length);
                }
            }

            for(int i=0;i<m_pBodyParts.Count;i++){
                MIME_Entity bodyPart = m_pBodyParts[i];

                // First boundary has no preceeding CRLF.
                if(i == 0){
                    byte[] bStart = Encoding.UTF8.GetBytes("--" + this.Entity.ContentType.Param_Boundary + "\r\n");
                    stream.Write(bStart,0,bStart.Length);
                }
                // Boundaries > 1.
                else{
                    byte[] bStart = Encoding.UTF8.GetBytes("\r\n--" + this.Entity.ContentType.Param_Boundary + "\r\n");
                    stream.Write(bStart,0,bStart.Length);
                }
                                
                bodyPart.ToStream(stream,headerWordEncoder,headerParmetersCharset,headerReencode);

                // Last body part, close boundary.
                if(i == (m_pBodyParts.Count - 1)){
                    byte[] bEnd = Encoding.UTF8.GetBytes("\r\n--" + this.Entity.ContentType.Param_Boundary + "--");
                    stream.Write(bEnd,0,bEnd.Length);
                }
            }

            // Set "epilogoue" text if any.
            if(!string.IsNullOrEmpty(m_TextEpilogue)){
                if(m_TextEpilogue.StartsWith("\r\n")){                    
                    byte[] epilogoueBytes = Encoding.UTF8.GetBytes(m_TextEpilogue);
                    stream.Write(epilogoueBytes,0,epilogoueBytes.Length);
                }
                else{                    
                    byte[] epilogoueBytes = Encoding.UTF8.GetBytes("\r\n" + m_TextEpilogue);
                    stream.Write(epilogoueBytes,0,epilogoueBytes.Length);
                }
            }
        }
开发者ID:DJGosnell,项目名称:LumiSoft.Net,代码行数:83,代码来源:MIME_b_Multipart.cs

示例11: ToByte

        /// <summary>
        /// Returns MIME entity as byte[].
        /// </summary>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified, 
        /// original encoding is kept.</param>
        /// <returns>Returns MIME entity as byte[].</returns>
        public byte[] ToByte(MIME_Encoding_EncodedWord headerWordEncoder,Encoding headerParmetersCharset,bool headerReencode)
        {
            using(MemoryStream ms = new MemoryStream()){
                ToStream(ms,headerWordEncoder,headerParmetersCharset,headerReencode);

                return ms.ToArray();
            }
        }
开发者ID:dioptre,项目名称:nkd,代码行数:16,代码来源:MIME_Entity.cs

示例12: ToString

        /// <summary>
        /// Returns MIME entity as string.
        /// </summary>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified, 
        /// original encoding is kept.</param>
        /// <returns>Returns MIME entity as string.</returns>
        public string ToString(MIME_Encoding_EncodedWord headerWordEncoder,Encoding headerParmetersCharset,bool headerReencode)
        {
            using(MemoryStream ms = new MemoryStream()){
                ToStream(ms,headerWordEncoder,headerParmetersCharset,headerReencode);

                return Encoding.UTF8.GetString(ms.ToArray());
            }
        }
开发者ID:dioptre,项目名称:nkd,代码行数:16,代码来源:MIME_Entity.cs

示例13: ToStream

        /// <summary>
        /// Store MIME enity to the specified stream.
        /// </summary>
        /// <param name="stream">Stream where to store MIME entity. Storing starts form stream current position.</param>
        /// <param name="headerWordEncoder">Header 8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="headerParmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="headerReencode">If true always specified encoding is used for header. If false and header field value not modified, 
        /// original encoding is kept.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stream</b> is null.</exception>
        public void ToStream(Stream stream,MIME_Encoding_EncodedWord headerWordEncoder,Encoding headerParmetersCharset,bool headerReencode)
        {
            if(stream == null){
                throw new ArgumentNullException("stream");
            }

            m_pHeader.ToStream(stream,headerWordEncoder,headerParmetersCharset,headerReencode);
            stream.Write(new byte[]{(int)'\r',(int)'\n'},0,2);
            m_pBody.ToStream(stream,headerWordEncoder,headerParmetersCharset,headerReencode);
        }
开发者ID:dioptre,项目名称:nkd,代码行数:19,代码来源:MIME_Entity.cs

示例14: ToString

        /// <summary>
        /// Returns MIME header as string.
        /// </summary>
        /// <param name="wordEncoder">8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="parmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="reEncode">If true always specified encoding is used. If false and header fields which value not modified, original encoding is kept.</param>
        /// <returns>Returns MIME header as string.</returns>
        public string ToString(MIME_Encoding_EncodedWord wordEncoder,Encoding parmetersCharset,bool reEncode)
        {
            StringBuilder retVal = new StringBuilder();
            foreach(MIME_h field in m_pFields){
                retVal.Append(field.ToString(wordEncoder,parmetersCharset,reEncode));
            }

            return retVal.ToString();
        }
开发者ID:MichaelChansn,项目名称:Lumisoft.Net,代码行数:16,代码来源:MIME_h_Collection.cs

示例15: ToStream

        /// <summary>
        /// Stores header to the specified stream.
        /// </summary>
        /// <param name="stream">Stream where to store header.</param>
        /// <param name="wordEncoder">8-bit words ecnoder. Value null means that words are not encoded.</param>
        /// <param name="parmetersCharset">Charset to use to encode 8-bit header parameters. Value null means parameters not encoded.</param>
        /// <param name="reEncod">If true always specified encoding is used for header. If false and header field value not modified, 
        /// original encoding is kept.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stream</b> is null reference.</exception>
        public void ToStream(Stream stream,MIME_Encoding_EncodedWord wordEncoder,Encoding parmetersCharset,bool reEncod)
        {
            if(stream == null){
                throw new ArgumentNullException("stream");
            }

            byte[] header = Encoding.UTF8.GetBytes(ToString(wordEncoder,parmetersCharset,reEncod));
            stream.Write(header,0,header.Length);
        }
开发者ID:MichaelChansn,项目名称:Lumisoft.Net,代码行数:18,代码来源:MIME_h_Collection.cs


注:本文中的LumiSoft.Net.MIME.MIME_Encoding_EncodedWord类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。