Code Monkey home page Code Monkey logo

smtp's Introduction

SMTP library for D - version 0.1.1

Native synchronous SMTP client implementation in D language. Get at official Dub repository: code.dlang.org

Tested with:

  • gdc-4.8 dmd-2.065.0 on Ubuntu 13.10
  • dmd-2.065.0 on OS X 10.9.2

Features

  1. SmtpClient class that implements SMTP client (mostly low-level functions)
  2. MailSender class that implements simplified API
  3. GMailSender is a MailSender predefined to use GMail's smtp gateway (ssl version only)
  4. SmtpMessage class that implements SMTP message fields storage
  5. SSL/TLS encryption support (via OpenSSL). Next encryption methods implemented:
  • SSLv2
  • SSLv23
  • SSLv3
  • TLSv1
  1. Authentication support which includes the next methods:
  • PLAIN
  • LOGIN

TODO

  1. More authentication methods.
  2. More Dedicated clients for popular mail providers, additional API simplification.
  3. Unit-tests suite.
  4. Asynchronous version (based on fibers?)

Installation

You can use smtp library for D via dub package manager. For this, follow the next steps:

  1. Download dub from DLang site (if you still don't have it installed).

  2. Create your project (or use dub.json from your existing one).

  3. Add smtp as a dependency:

    {
      "dependencies": {
      		"smtp": ">=0.1.1",
      }
    }
  4. Use dub to build smtp library:

    without SSL/TLS support

    $ dub

    or with SSL/TLS support:

    $ dub -c ssl

    To chose right smtp building configuration for your project use subConfigurations setting in your project's dub.json:

    {
      "subConfigurations": { "smtp": "no-ssl" }
    }

    Available configurations are:

    • no-ssl by default
    • ssl to build with OpenSSL support

Usage

You can find low-level API usage example projects in examples folder:

  1. lowlevel Shows the simplest chain of routines to send e-mail message via unencrypted channel.

  2. lowlevel-tls Shows the simplest chain of routines to send e-mail message via encrypted channel.

  3. sender Shows how to authenticate and send a message using high-level API via MailSender class: connect, authenticate, send methods. MailSender high-level methods provide thread-safety.

You can enter folder examples/<example-project-name> and perform $ dub in order to run and test example.

If you're a Linux or OS X user, you can use standard sendmail utility to get SMTP server up and running on your local host. For that just open new terminal tab or window and type sendmail.

If you want to test encrypted client, you can use smtp.gmail.com:587 along with TLSv1 encryption method. Obviously this works with ssl configuration of smtp library only.

Here's an example of high-level SmtpClient API usage for sending sample email either using open or encrypted channel.

smtp's People

Contributors

sspkrolik avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.