it should add the multipart header if text and html message is present
auto message = Message(); message.textMessage = "text"; message.htmlMessage = "html"; message.headers[0].should.equal(`MIME-Version: 1.0`); message.headers[1].should.equal(`Content-Type: multipart/alternative; boundary="` ~ message.boundary ~ `"`);
it should not add the multipart header if the html message is missing
auto message = Message(); message.textMessage = "text"; message.headers.length.should.be.equal(0);
it should generate an unique boundary
auto message1 = Message(); auto message2 = Message(); message1.boundary.should.not.equal(""); message1.boundary.should.not.be.equal(message2.boundary); message1.boundary.should.not.startWith(message2.boundary); message2.boundary.should.not.startWith(message1.boundary);
body should contain only the text message when html is missing
auto message = Message(); message.textMessage = "text"; message.mailBody.should.equal("text");
body should contain a mime body
auto message = Message(); message.textMessage = "text"; message.htmlMessage = "html"; string expected = "This is a multi-part message in MIME format\r\n\r\n"; expected ~= "--" ~ message.boundary ~ "\r\n"; expected ~= `Content-Type: text/plain; charset="utf-8"` ~ "\r\n\r\n"; expected ~= "text\r\n"; expected ~= "--" ~ message.boundary ~ "\r\n"; expected ~= `Content-Type: text/html; charset="utf-8"` ~ "\r\n\r\n"; expected ~= "html\r\n"; expected ~= "--" ~ message.boundary ~ "--"; message.mailBody.should.equal(expected);