On Tuesday, 29 September 2015 at 08:54:39 UTC, Daniel Kozak wrote:
Wow, I need something like this 3 weeks ago, but I dont have time to implement this myself, so I end up with phpMailer. Now I can switch my little e-mailing system to Dlang. Thank you.

If you ever need something in D, ask me first.... there's a good chance I've written it!


....there's also a good chance I haven't documented it too though...

but the way mine works is something like:

import arsd.email;
void main() {
        auto message = new EmailMessage();
        message.to ~= "destructiona...@gmail.com";
        message.from = "t...@arsdnet.net";
        message.subject = "test";
message.setHtmlBody("<img src=\"cid:amazing\" /><b>test</b>"); message.addAttachment("text/csv", "cool.csv", "whoa,mang");
        message.addAttachment("text/wtf", "whoa.wtf", "WTF\nMAN");
message.addInlineImage("amazing", "image/png", "black.png",

The send method uses std.net.curl to do the actual sending (the smtp connection information is a default argument to the method.

My lib also has a function:

void email(string to, string subject, string message, string from, RelayInfo mailServer = RelayInfo("smtp://localhost")) {}

for sending a plain text email quickly and easily, similar to PHP's mail function.

Reply via email to