Exemplo n.º 1
0
        public static ContentType MultipartContent(Multipart multipart = default, string boundary = null)
        {
            if (string.IsNullOrWhiteSpace(boundary))
            {
                boundary = MultiPartBoundary.Generate();
            }

            return(new ContentType($"multipart/{multipart.ToString().ToLower()}", false, "")
            {
                Boundary = boundary.Substring(0, 70).TrimEnd()
            });
        }
Exemplo n.º 2
0
        private void UpdateContentTypeHeader()
        {
            string contentTypeString = Constants.ContentTypes.Soap;

            if (Attachments.Any())
            {
                ContentType contentType = new Multipart("related").ContentType;
                contentType.Parameters["type"] = contentTypeString;
                contentType.Charset            = Encoding.UTF8.HeaderName.ToLowerInvariant();
                contentTypeString = contentType.ToString();
            }

            ContentType = contentTypeString.Replace("Content-Type: ", string.Empty);
        }