Skip to content

Commit deb3695

Browse files
authored
Merge pull request #2819 from Geod24/mlang/Timeout
feat(smtp/sendMail): Also use timeout as readTimeout
2 parents 3de8aa1 + ed72a70 commit deb3695

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mail/vibe/mail/smtp.d

+7
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ final class Mail {
132132
at least the headers "To", "From", Sender" and "Subject".
133133
134134
Valid headers can be found at http://tools.ietf.org/html/rfc4021
135+
136+
Params:
137+
settings = Settings to send this email (e.g. server, credentials, TLS context)
138+
mail = The email data to send
139+
timeout = A timeout that will be applied to connection & reading.
135140
*/
136141
void sendMail(in SMTPClientSettings settings, Mail mail, in Duration timeout = Duration.max())
137142
{
@@ -143,6 +148,8 @@ void sendMail(in SMTPClientSettings settings, Mail mail, in Duration timeout = D
143148
~to!string(settings.port), e);
144149
}
145150
scope(exit) raw_conn.close();
151+
if (timeout < Duration.max())
152+
raw_conn.readTimeout = timeout;
146153

147154
InterfaceProxy!Stream conn = raw_conn;
148155

0 commit comments

Comments
 (0)