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

Russel Winder via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Sep 29 00:24:35 PDT 2015


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\" <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
-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20150929/6cfc8915/attachment.sig>


More information about the Digitalmars-d-announce mailing list