vibemail 1.0.2

Extensions for vibe's Mail class to send multi-part emails with attachments.


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

dub.json
dub.sdl

VibeMail

Extensions for vibe's Mail class to send multi-part emails with attachments.

Usage

The Mail and SMTP settings come from vibe. The extensions are in the email.setContent(...) part.

import vibe.d;
import vibemail.email;

void main()
{
	auto settings = new SMTPClientSettings("secure.emailsrvr.com",587);
	settings.authType = SMTPAuthType.login;
	settings.connectionType = SMTPConnectionType.startTLS;
	settings.tlsValidationMode = TLSPeerValidationMode.requireCert;
	settings.username = "info@example.com";
	settings.password = "123456789";

	Mail email = new Mail;
	email.headers["Date"] = Clock.currTime().toRFC822DateTimeString();
	email.headers["Sender"] = "Domain.com Contact Form ";
	email.headers["From"] = "\"Example\" <info@example.com>";
	email.headers["To"] = "\"Bas\" <bas@example.com>";
	email.headers["Subject"] = "My subject";
	import std.stdio;

	// Here are the extensions
	email.setContent(
		mailMixed(
			mailRelated(
				mailAlternative(
					mailHtml("<html><body><center>asdfasdfasdf</center></body></html>"),
					mailText("asdfasdfasdf")
				)
			),
			mailAttachment(File("test.png","rb"),"image/png","image.png"),
			mailAttachment(cast(immutable(ubyte[]))"You are an idiot!","plain/text","text.txt")
		)
	);
	// End

	sendMail(settings, email);

	runEventLoop();
}
Authors:
  • Sebastiaan Koppe
Dependencies:
vibe-d
Versions:
2.0.3 2018-Jul-18
2.0.2 2018-Jul-15
2.0.1 2017-Jul-26
2.0.0 2015-Oct-22
1.0.2 2015-Oct-02
Show all 8 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 1 downloads this month

  • 270 downloads total

Score:
1.7
Short URL:
vibemail.dub.pm