RejectedSoftware Forums

Sign up

setting useTrustedCertificateFile

I'm trying to send an email via a server that uses starttls - currently, certificate verification fails because openssl thinks it's self-signed (although it's not).

Using openssl s_client, if I pass CAPath, the certificate verification succeeds - how would I go about this in my vibe app?

I see that there seems to be access to the TLSContext through SMTPClientSettings, although I'm having trouble with getting it to work. I'm trying to set useTrustedCertificateFile without success.

settings.connectionType = SMTPConnectionType.startTLS;
settings.authType = SMTPAuthType.login;
settings.tlsVersion = TLSVersion.ssl3; // required or handshake fails
settings.tlsContextSetup = ???

I've tried a few different syntaxes for setting useTrustedCertificateFile without success.

Also, in looking through vibe.mail.smtp.d, it appears that for SMTPConnectionType.tls, the SMTP settings - settings.tlsContextSetup - is passed to the TLSContext, but is that happening for SMTPConnectionType.startTLS?

Thank you!

Nathan

Re: setting useTrustedCertificateFile

I think I have this sorted out -- the main issue was me not understanding the mechanisms of scope, delegates and callbacks.

Another issue was that the callback to tlsContextSetup was missing in vibe.mail.smtp.sendEmail when settings.connectionType == SMTPConnectionType.startTLS - I'll submit a quick pull request.

Nathan