smtp 0.3.0
Synchronous SMTP library for D language
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
SMTP library for D - version 0.3
Native synchronous SMTP client implementation in D language. Get at official Dub repository: code.dlang.org
Tested with:
dmd-2.066.0stable on Ubuntu 15.04 Vivid Vervet
Features Supported
- Low-level SMTP client via
SmtpClient. - High-level SMTP client via
MailSender. - Dedicated GMail SMTP gateway client via
GMailSender(ssl version only) - Attachments support.
SSL/TLSencryption support (viaOpenSSL). Next encryption methods implemented:
SSLv2SSLv23SSLv3TLSv1
- Authentication support which includes the next methods:
PLAINLOGIN
TODO
- More authentication methods.
- More Dedicated clients for popular mail providers, additional API simplification.
- Unit-tests suite.
- Asynchronous version of the library.
- Chunking support.
Installation
You can use smtp library for D via dub package manager.
For this, follow the next steps:
- Download dub from DLang site (if you still don't have it installed).
- Create your project (or use
dub.jsonfrom your existing one). - Add
smtpas a dependency:{ "dependencies": { "smtp": ">=0.1.1", } } - Use dub to build smtp library:
without SSL/TLS support
$ dubor with SSL/TLS support:
$ dub -c sslor with SSL/TLS support when OpenSSL is prebuilt without SSLv2 support:
$ dub -c ssl-no-ssl2To chose right smtp building configuration for your project use
subConfigurationssetting in your project'sdub.json:{ "subConfigurations": { "smtp": "no-ssl" } }Available configurations are:
no-sslby defaultsslto build withOpenSSLsupport
Usage
You can find low-level API usage example projects in examples folder:
lowlevelShows the simplest chain of routines to send e-mail message via unencrypted channel.lowlevel-tlsShows the simplest chain of routines to send e-mail message via encrypted channel. Note: if you want to use SSLv2 encryption type for some reason, you have to change `"smtp": "ssl-no-ssl2"` to `"smtp": "ssl2"` in `subConfiguration` section of the example's dub.json file.senderShows how to authenticate and send a message using high-level API viaMailSenderclass:connect,authenticate,send, andquitmethods.MailSenderhigh-level methods provide thread-safety.attachmentsShows how to send messages with attachments usingMailSenderclass viaattachmethod andSmtpAttachmentstructure.
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.
- 0.3.0 released 10 years ago
- SSPkrolik/smtp
- sspkrolik.github.io/smtp
- MIT
- Copyright © 2014-2015, Rostyslav Dzinko
- Authors:
- Dependencies:
- none
- Versions:
-
Show all 11 versions0.3.0 2015-Jul-17 0.2.1 2015-Jul-15 0.2.0 2014-Apr-22 0.1.1 2014-Apr-12 0.1.0 2014-Apr-12 - Download Stats:
-
-
0 downloads today
-
1 downloads this week
-
16 downloads this month
-
11305 downloads total
-
- Score:
- 1.5
- Short URL:
- smtp.dub.pm