mail 0.4.2

Synchronous POP3/SMTP Library


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:

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
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 350 downloads total

Score:
1.1
Short URL:
mail.dub.pm