Comments (2)
I coded this up for me to use self-signed certificates.
It is also required for client certificates or other pki magic
work for me
diff --git a/subtree/go-imap/imapclient/client.go b/subtree/go-imap/imapclient/client.go
index eb50b7647b..9990eeba0e 100644
--- a/subtree/go-imap/imapclient/client.go
+++ b/subtree/go-imap/imapclient/client.go
@@ -169,10 +169,15 @@ func New(conn net.Conn, options *Options) *Client {
}
// DialTLS connects to an IMAP server with implicit TLS.
-func DialTLS(address string, options *Options) (*Client, error) {
- conn, err := tls.Dial("tcp", address, &tls.Config{
- NextProtos: []string{"imap"},
- })
+func DialTLS(address string, options *Options, tlsConfigp *tls.Config) (*Client, error) {
+ var tlsConfig *tls.Config
+ if tlsConfigp != nil {
+ tlsConfig = tlsConfigp.Clone()
+ } else {
+ tlsConfig = &tls.Config{}
+ }
+ tlsConfig.NextProtos = []string{"imap"}
+ conn, err := tls.Dial("tcp", address, tlsConfig)
if err != nil {
return nil, err
}
diff --git a/subtree/go-imap/imapclient/example_test.go b/subtree/go-imap/imapclient/example_test.go
index 0cd0e747b4..282af7e162 100644
--- a/subtree/go-imap/imapclient/example_test.go
+++ b/subtree/go-imap/imapclient/example_test.go
@@ -12,7 +12,7 @@ import (
)
func ExampleClient() {
- c, err := imapclient.DialTLS("mail.example.org:993", nil)
+ c, err := imapclient.DialTLS("mail.example.org:993", nil, nil)
if err != nil {
log.Fatalf("failed to dial IMAP server: %v", err)
}
@@ -232,7 +232,7 @@ func ExampleClient_Idle() {
},
}
- c, err := imapclient.DialTLS("mail.example.org:993", &options)
+ c, err := imapclient.DialTLS("mail.example.org:993", &options, nil)
:
from go-imap.
It's not required, you can create your own net.Conn
and pass it to NewClient
.
from go-imap.
Related Issues (20)
- Implement limits for parser HOT 1
- v2: client: Close race conditions HOT 4
- v2 client: Status with ststusOption nil hangs HOT 1
- v2 STORE flags not returned HOT 2
- v2 DebugWriter breaks LOGIN or any imap command HOT 2
- v2 Invokes Client.conn.Close multiple times producing errors HOT 1
- v1 branch overwritten? HOT 2
- Set timeout for Dial() HOT 1
- Support IMAP4 ID command (RFC 1971) HOT 9
- Cannot connect to Cyrus IMAP 2.5 - hangs on login HOT 4
- Idle client v2 stops receiving new emails in some time. HOT 5
- The receiving mail runs on the cloud server
- Raw UTF-8 is rejected by utf7 package when UTF8=ACCEPT is enabled
- utf7: simplify implementation
- Disable UTF-7 encoding for IMAP4rev2
- v1: connection hangs forever in "handleGreetAndStartReading" HOT 1
- v2: fails to parse imap server response HOT 2
- client: Dovecot startup failure hangs test HOT 1
- FETCH command did not return any message HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-imap.