SmtpMisc.cs :  » RSS-RDF » Aggie » Bitworking » Smtp » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » RSS RDF » Aggie 
Aggie » Bitworking » Smtp » SmtpMisc.cs
// SmtpMisc.cs
//
// This file is based (in parts) on SmtpEmailer code by Steaven Woyan (mailto:swoyan@hotmail.com),
// and by extension on logic/code design from PJ Naughter's C++ SMTP package
// located at http://www.naughter.com/smpt.html.
//
// The original code has been adapted for use in Aggie by Ziv Caspi.
// See SmtpBatchMailer.cs for a list of changes.

using System;

namespace Bitworking.Smtp{
  /// <summary>
  /// Possible response values returned from an SMTP host.
  /// </summary>
  public enum SmtpResponseCodes {
    SystemStatus = 211,
    Help = 214,
    Ready = 220,
    ClosingChannel = 221,
    RequestCompleted = 250,
    UserNotLocalOk = 251,
    StartInput = 354,
    ServiceNotAvailable = 421,
    MailBoxUnavailable = 450,
    RequestAborted = 451,
    InsufficientStorage = 452,
    Error = 500,
    SyntaxError = 501,
    CommandNotImplemented = 502,
    BadSequence = 503,
    CommandParameterNotImplemented = 504, 
    MailBoxNotFound = 550,
    UserNotLocalBad = 551,
    ExceededStorage = 552,
    MailBoxNameNotValid = 553,
    TransactionFailed = 554
  } // enum SmtpResponseCodes

  /// <summary>
  /// Specifies how is the attachment carried by the message.
  /// </summary>
  public enum HowAttached {
    /// <summary>
    /// A regular attachment, external to the body.
    /// </summary>
    Externally = 0,
    /// <summary>
    /// Inlined MIME attachment (such as HTML images)
    /// </summary>
    Inlined = 1
  } // enum HowAttached

  /// <summary>
  /// Encapsulates the information relevant for a single attachment item.
  /// </summary>
  public class SmtpAttachment {
    #region Private data
    // TODO: Remove this:   internal static int inlineCount; -- Number of Inlined attachments
    // TODO: Remove this:   internal static int attachCount; -- Number of ExternalAttachment attachments
    /// <summary>
    /// The file that holds the attachment data.
    /// </summary>
    private string filename;
    /// <summary>
    /// The MIME type of the attachment data (such as application/octet-stream
    /// for unknown types).
    /// </summary>
    private string contentType;
    /// <summary>
    /// How is the item attached to the mail message.
    /// </summary>
    private HowAttached howAttached;
    #endregion

    #region Properties
    public HowAttached HowAttached {
      get { return howAttached; }
    }
    public string Filename {
      get { return filename; }
    }
    public string ContentType {
      get { return contentType; }
    }
    #endregion

    #region Construction
    public SmtpAttachment( string filename, string contentType, HowAttached howAttached ) {
      this.filename = filename;
      this.contentType = contentType;
      this.howAttached = howAttached;
    } // SmtpAttachment( string, string, HowAttached )
    public SmtpAttachment( string filename )
      : this( filename, "application/octet-stream", HowAttached.Externally ) {
    } // SmtpAttachment( string )
    #endregion

    #region System.Object overriders
    public override string ToString() {
      return filename;
    }
    #endregion
  } // class SmtpAttachment
} // namespace Bitworking.Smtp

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.