On Tue, 2015-09-29 at 03:53 +0000, Sebastiaan Koppe via Digitalmars-d -announce wrote: > This library[1] allows you to send multi-part emails with > attachments.
This code looks so similar to the equivalent in Python, it is great. Does it need Vibe underneath it though to work, or is this a package that can sit separately and just use sockets to connect to the SMTP server as with Python? Though I would rather there was no HTML in any email! > ``` > Mail email = new Mail; > email.headers["Date"] = Clock.currTime().toRFC822DateTimeString(); > email.headers["Sender"] = "Domain.com Contact Form "; > email.headers["From"] = "\"Example\" <[email protected]>"; > email.headers["To"] = "\"Bas\" <[email protected]>"; > email.headers["Subject"] = "My subject"; > import std.stdio : File; > 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") > ) > ); > sendMail(settings, email); > ``` > > [1] http://code.dlang.org/packages/vibemail -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected] 41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected] London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
