mail 0.4.2

Synchronous POP3/SMTP Library


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Mail

Mail is a synchronous POP3/SMTP library for D programming language. It is available as a package in the dub registry

Usage

import std.stdio;
import mail.smtp;

void main()
{
	SmtpReply r;
	auto link = new Smtp("localhost");
	r = link.connect;
	writeln(r.success, " ", r);

	r = link.startTLS;
	writeln(r.success, " ", r);

	r = link.helo;
	writeln(r.success, " ", r);
	r = link.ehlo;
	writeln(r.success, " ", r);

	r = link.auth(SmtpAuthType.LOGIN);
	writeln(r.success, " ", r);

	r = link.authLoginUsername("user");
	writeln(r.success, " ", r);

	r = link.authLoginPassword("password");
	writeln(r.success, " ", r);


	r = link.mailFrom("root@localhost");
	writeln(r.success, " ", r);

	r = link.rcptTo("root@localhost");
	writeln(r.success, " ", r);
	
	r = link.data();
	writeln(r.success, " ", r);

	r = link.dataBody("test");
	writeln(r.success, " ", r);

	Msg m;

	m.headers["subject"] = "Test";
	m.data = "Test sdf sdf sd sdf sdfs dfsdf sdfs dfs dfs df sdf sdfs dfdsdfsdsfdsf s  sdfs dfs dfsfsdf";


	Msg m2;
	m2.headers["content-type"] = "text/html";
	m2.data = "<html><body><h1>TEST</h1></body></html>";
	
	m.parts ~= m2;
	
	
	r = link.send("root@localhost", ["root@localhost"], m);
	writeln(r.success, " ", r);


	r = link.quit();
	writeln(r.success, " ", r);

	link.disconnect();
}

See examples for more usage demo

Authors:Anton Dutov, Rostyslav Dzinko

Dependencies:openssl

Versions:
0.4.2 2017-Jun-01
0.4.1 2017-Jun-01
0.4.0 2017-May-31
0.3.1 2016-Nov-19
0.3.0 2016-Nov-18
Show all 12 versions
Stats:

statistics are temporarily disabled.