SMTP Mail

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 24 19:13:42 PDT 2017


On Tuesday, 22 August 2017 at 12:52:24 UTC, Vino.B wrote:
>   Request your help on sending Mails, I am able to receive 
> mails with empty body the line "smtp.message ="Example Message" 
> doesn't seem to be working and also please let me know how do i 
> send a file as a attachment in a email.

The message there needs to be the complete message, including 
headers. The SMTP struct is pretty low-level.

My email.d (plus its dependencies, characterencodings.d, dom.d, 
and htmltotext.d) has the code to form a full message. It isn't 
very documented though.

https://github.com/adamdruppe/arsd


auto message = new EmailMessage();
message.to ~= "some at email";
message.subject = "Subject"
message.setTextBody("hi");
message.send(RelayInfo("smtp://whatever", "user", "pass"));


More information about the Digitalmars-d-learn mailing list