mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
39 lines
898 B
Go
39 lines
898 B
Go
package bridge
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/ProtonMail/proton-bridge/v2/internal/clientconfig"
|
|
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
|
"github.com/ProtonMail/proton-bridge/v2/internal/useragent"
|
|
)
|
|
|
|
func (bridge *Bridge) ConfigureAppleMail(userID, address string) error {
|
|
user, ok := bridge.users[userID]
|
|
if !ok {
|
|
return ErrNoSuchUser
|
|
}
|
|
|
|
if address == "" {
|
|
address = user.Addresses()[0]
|
|
}
|
|
|
|
// If configuring apple mail for Catalina or newer, users should use SSL.
|
|
if useragent.IsCatalinaOrNewer() && !bridge.vault.GetSMTPSSL() {
|
|
if err := bridge.SetSMTPSSL(true); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return (&clientconfig.AppleMail{}).Configure(
|
|
constants.Host,
|
|
bridge.vault.GetIMAPPort(),
|
|
bridge.vault.GetSMTPPort(),
|
|
bridge.vault.GetIMAPSSL(),
|
|
bridge.vault.GetSMTPSSL(),
|
|
address,
|
|
strings.Join(user.Addresses(), ","),
|
|
user.BridgePass(),
|
|
)
|
|
}
|