Ejemplo n.º 1
0
        // Content-Type: multipart/...; boundary=...
        public void SetBoundary(string pszBoundary)
        {
            if (pszBoundary == null)
            {
                Random randObj = new Random((int)DateTime.Now.Ticks);
                pszBoundary = "__=_Part_Boundary_" + randObj.Next().ToString() + "_" + randObj.Next().ToString();
            }

            MimeField aMimeField = GetField(MimeConst.ContentType);

            if (aMimeField != null)
            {
                if (aMimeField.GetValue().IndexOf("multipart", 0, 9) == -1)
                {
                    aMimeField.SetValue("multipart/mixed");
                }
                aMimeField.SetParameter(MimeConst.Boundary, "\"" + pszBoundary + "\"");
            }
            else
            {
                aMimeField = new MimeField();
                aMimeField.SetName(MimeConst.ContentType);
                aMimeField.SetValue("multipart/mixed");
                aMimeField.SetParameter(MimeConst.Boundary, "\"" + pszBoundary + "\"");
                m_listFields.Add(aMimeField);
            }
        }
Ejemplo n.º 2
0
        public string GetFieldValue(string pszFieldName)
        {
            MimeField aMimeField = GetField(pszFieldName);

            return(aMimeField != null?aMimeField.GetValue() : null);
        }