smtp 0.0.4
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
Current version: 0.0.3
Native SMTP client implementation in D language.
Tested with:
gdc-4.8
on Ubuntu 13.10dmd-2.065.0
on OS X 10.9.2
Features
SmtpClient
class that implements SMTP client.SmtpMessage
class that implements SMTP message fields storage.SSL/TLS
encryption support (viaOpenSSL
). Next encryption types implemented:SSLv3
.
TODO
- Authentication 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.json
from your existing one). - Add
smtp
as a dependency:{ "dependencies": { "smtp": ">=0.0.3", } }
- Use dub to build project:
$ dub
Usage
Here's an example of high-level SmtpClient
API usage for sending sample email
either using open or encrypted channel.
#!/usr/bin/rdmd
import std.stdio;
import std.string;
import smtpclient;
import smtpmessage;
void main() {
auto message = new SmtpMessage(
"[email protected]", // Sender (put some existing address here)
["[email protected]", "[email protected]"], // Recipients (put some existing addresses here)
"Test message subject", // Subject (topic)
"This is a test message body", // Body of the message
"" // Reply-to still does not work
);
auto client = new SmtpClient(
"localhost", // SMTP server host
25 // SMTP server port
);
client.connect(); // Perform connection
// Uncomment next line to start TLS-encrypted communication with server
// client.startTls(EncryptType.SSLv3);
if (client.send(message)) { // Check if message was sent successfully
writefln("Message: `%s` from <%s> to <%s> sent successfully!",
message.subject, message.sender, message.recipients);
} else {
writefln("Message was not sent for some reason");
}
client.quit(); // Tell SMTP server we're done with sending messages
client.disconnect(); // Making clean disconnect from server
}
- Registered by Rostyslav Dzinko
- 0.0.4 released 10 years ago
- SSPkrolik/smtp
- github.com/SSPkrolik/smtp
- MIT
- Copyright © 2014, Rostyslav Dzinko
- Authors:
- Dependencies:
- openssl
- System dependencies:
- OpenSSL 0.9.x or 1.0.x
- Versions:
-
0.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
-
0 downloads this week
-
0 downloads this month
-
11258 downloads total
-
- Score:
- 1.2
- Short URL:
- smtp.dub.pm