Skip to content

Commit

Permalink
Merge pull request vibe-d#582 from Extrawurst/patch-1
Browse files Browse the repository at this point in the history
support multiple To's in sendMail
  • Loading branch information
s-ludwig committed Mar 17, 2014
2 parents 24cfdcd + a974c3d commit bbe789e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions source/vibe/mail/smtp.d
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,20 @@ void sendMail(SMTPClientSettings settings, Mail mail)
conn.write("MAIL FROM:"~addressMailPart(mail.headers["From"])~"\r\n");
expectStatus(conn, SMTPStatus.success, "MAIL FROM");

conn.write("RCPT TO:"~addressMailPart(mail.headers["To"])~"\r\n"); // TODO: support multiple recipients
expectStatus(conn, SMTPStatus.success, "RCPT TO");
mail.headers.getAll("To", (v){
conn.write("RCPT TO:"~addressMailPart(v)~"\r\n");
expectStatus(conn, SMTPStatus.success, "RCPT TO");
});
mail.headers.getAll("Cc", (v){
conn.write("RCPT TO:"~addressMailPart(v)~"\r\n");
expectStatus(conn, SMTPStatus.success, "RCPT TO");
});
mail.headers.getAll("Bcc", (v){
conn.write("RCPT TO:"~addressMailPart(v)~"\r\n");
expectStatus(conn, SMTPStatus.success, "RCPT TO");
});

mail.headers.removeAll("Bcc");

conn.write("DATA\r\n");
expectStatus(conn, SMTPStatus.startMailInput, "DATA");
Expand Down

0 comments on commit bbe789e

Please sign in to comment.