Click here to Skip to main content
15,896,040 members
Articles / Programming Languages / C#

A class for sending emails with attachments in C#.

Rate me:
Please Sign up or sign in to vote.
4.82/5 (62 votes)
28 Feb 20032 min read 491.6K   5.2K   127  
A class for sending emails with attachments in C#.
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>SmtpEmailer</name>
    </assembly>
    <members>
        <member name="T:smw.smtp.SmtpConnection">
            <summary>
            Class for handling an SMTP connection.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpConnection.#ctor">
            <summary>
            Create a new connection.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpConnection.Open(System.String)">
            <summary>
            Open connection with specified host and default port.
            </summary>
            <param name="host">Host name to connect to.</param>
        </member>
        <member name="M:smw.smtp.SmtpConnection.Open(System.String,System.Int32)">
            <summary>
            Open connection to host on port.
            </summary>
            <param name="host">Host name to connect to.</param>
            <param name="port">Port to connect to.</param>
        </member>
        <member name="M:smw.smtp.SmtpConnection.Close">
            <summary>
            Close connection.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpConnection.SendCommand(System.String)">
            <summary>
            Send a command to the server.
            </summary>
            <param name="cmd">Command to send.</param>
        </member>
        <member name="M:smw.smtp.SmtpConnection.SendData(System.Char[],System.Int32,System.Int32)">
            <summary>
            Send data to the server. Used for sending attachments.
            </summary>
            <param name="buf">Data buffer.</param>
            <param name="start">Starting position in buffer.</param>
            <param name="length">Length to send.</param>
        </member>
        <member name="M:smw.smtp.SmtpConnection.GetReply(System.String@,System.Int32@)">
            <summary>
            Get the reply message from the server.
            </summary>
            <param name="reply">Text reply from server.</param>
            <param name="code">Status code from server.</param>
        </member>
        <member name="P:smw.smtp.SmtpConnection.Connected">
            <summary>
            Connection status.
            </summary>
        </member>
        <member name="T:smw.smtp.SmtpEmailer">
            <summary>
            A class for sending email messages with attachments via SMTP.
            Steaven Woyan swoyan@hotmail.com
            Version 1.2 June 23, 2002
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.#ctor">
            <summary>
            Create an SmtpEmailer.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.SendMessage">
            <summary>
            Send the message.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.SendMessageAsync">
            <summary>
            Send the message on a seperate thread.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.SendAttachments(System.Text.StringBuilder,smw.smtp.AttachmentLocation)">
            <summary>
            Send any attachments.
            </summary>
            <param name="buf">String work area.</param>
            <param name="type">Attachment type to send.</param>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.EncodeBodyAsQuotedPrintable">
            <summary>
            Encode the body as in quoted-printable format.
            Adapted from PJ Naughter's quoted-printable encoding code.
            For more information see RFC 2045.
            </summary>
            <returns>The encoded body.</returns>
        </member>
        <member name="E:smw.smtp.SmtpEmailer.OnMailSent">
            <summary>
            Event sent when mail has been sent.
            </summary>
        </member>
        <member name="P:smw.smtp.SmtpEmailer.Host">
            <summary>
            Name of server.
            </summary>
        </member>
        <member name="P:smw.smtp.SmtpEmailer.Port">
            <summary>
            Port to connnect to on server.
            </summary>
        </member>
        <member name="P:smw.smtp.SmtpEmailer.From">
            <summary>
            From email address.
            </summary>
        </member>
        <member name="P:smw.smtp.SmtpEmailer.To">
            <summary>
            List of to email addresses.
            </summary>
        </member>
        <member name="P:smw.smtp.SmtpEmailer.Subject">
            <summary>
            Subject of message.
            </summary>
        </member>
        <member name="P:smw.smtp.SmtpEmailer.Body">
            <summary>
            Body of message.
            </summary>
        </member>
        <member name="P:smw.smtp.SmtpEmailer.Attachments">
            <summary>
            List of files to attach.
            </summary>
        </member>
        <member name="P:smw.smtp.SmtpEmailer.SendAsHtml">
            <summary>
            Send body as HTML?
            </summary>
        </member>
        <member name="T:smw.smtp.SmtpEmailer.ToList">
            <summary>
            A utilitiy class for holding the list of to addresses.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.ToList.#ctor(System.Collections.ArrayList)">
            <summary>
            Create the ToList.
            </summary>
            <param name="list">Associated array to store list data in.</param>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.ToList.Add(System.String)">
            <summary>
            Add an address to the list.
            </summary>
            <param name="address">Address to add.</param>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.ToList.Remove(System.String)">
            <summary>
            Remove an address from the list.
            </summary>
            <param name="address">Address to remove.</param>
        </member>
        <member name="T:smw.smtp.SmtpEmailer.AttachmentList">
            <summary>
            A utilitiy class for holding the list of to attachments.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.AttachmentList.#ctor(System.Collections.ArrayList)">
            <summary>
            Create the AttachmentList.
            </summary>
            <param name="list">Associated array to store list data in.</param>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.AttachmentList.Add(smw.smtp.SmtpAttachment)">
            <summary>
            Add an attachment.
            </summary>
            <param name="attachment">Attachment to add.</param>
        </member>
        <member name="M:smw.smtp.SmtpEmailer.AttachmentList.Remove(smw.smtp.SmtpAttachment)">
            <summary>
            Remove an attachment from the list.
            </summary>
            <param name="attachment">Attachment to remove.</param>
        </member>
        <member name="T:smw.smtp.SmtpEmailer.MailSentDelegate">
            <summary>
            Delegate for mail sent notification.
            </summary>
        </member>
        <member name="T:smw.smtp.AttachmentLocation">
            <summary>
            For use in SmtpAttachment.
            </summary>
        </member>
        <member name="F:smw.smtp.AttachmentLocation.Attachment">
            <summary>
            Send as regular attachment.
            </summary>
        </member>
        <member name="F:smw.smtp.AttachmentLocation.Inline">
            <summary>
            Send as MIME inline (for html images, etc).
            </summary>
        </member>
        <member name="T:smw.smtp.SmtpAttachment">
            <summary>
            Class for holding an attachment's information.
            </summary>
        </member>
        <member name="F:smw.smtp.SmtpAttachment.FileName">
            <summary>
            File to send.
            </summary>
        </member>
        <member name="F:smw.smtp.SmtpAttachment.ContentType">
            <summary>
            Content type of file (application/octet-stream for regular attachments).
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpAttachment.#ctor">
            <summary>
            Default constructor.
            </summary>
        </member>
        <member name="M:smw.smtp.SmtpAttachment.#ctor(System.String,System.String,smw.smtp.AttachmentLocation)">
            <summary>
            Constructor for passing all information at once.
            </summary>
            <param name="fileName">File to send.</param>
            <param name="contentType">Content type of file (application/octet-stream for regular attachments.)</param>
            <param name="location">Where to put the attachment.</param>
        </member>
        <member name="M:smw.smtp.SmtpAttachment.#ctor(System.String)">
            <summary>
            Shortcut constructor for passing regular style attachments.
            </summary>
            <param name="filename">File to send.</param>
        </member>
        <member name="M:smw.smtp.SmtpAttachment.ToString">
            <summary>
            Show this attachment.
            </summary>
            <returns>The file name of the attachment.</returns>
        </member>
        <member name="P:smw.smtp.SmtpAttachment.Location">
            <summary>
            Where to put the attachment.
            </summary>
        </member>
        <member name="T:smw.smtp.SmtpResponseCodes">
            <summary>
            List of SMTP reply codes.
            </summary>
        </member>
    </members>
</doc>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions