Vibemail - extensions for vibe's Mail class to send multi-part emails with attachments

Sebastiaan Koppe via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Sep 28 20:53:44 PDT 2015


This library[1] allows you to send multi-part emails with 
attachments.

```
Mail email = new Mail;
email.headers["Date"] = Clock.currTime().toRFC822DateTimeString();
email.headers["Sender"] = "Domain.com Contact Form ";
email.headers["From"] = "\"Example\" <info at example.com>";
email.headers["To"] = "\"Bas\" <bas at example.com>";
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


More information about the Digitalmars-d-announce mailing list