From d1654def192459f829496791406483a1286805e7 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Tue, 18 Jun 2019 14:07:51 +0200 Subject: [PATCH] account-wizard: automatically replace imap.* with smtp.* Many email providers use the imap sub-domain for imap and the smtp sub-domain for smtp. FastMail is an example of this[1]. This is a small quality-of-life improvement which automatically replaces imap.* with smtp.* when going from the imap screen to the smtp screen in the wizard [1]: https://www.fastmail.com/help/technical/servernamesandports.html --- widgets/account-wizard.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go index 010d82d..3d9cfd4 100644 --- a/widgets/account-wizard.go +++ b/widgets/account-wizard.go @@ -105,7 +105,12 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard { wizard.smtpUri() }) wizard.imapServer.OnChange(func(_ *ui.TextInput) { - wizard.smtpServer.Set(wizard.imapServer.String()) + imapServerURI := wizard.imapServer.String() + smtpServerURI := imapServerURI + if strings.HasPrefix(imapServerURI, "imap.") { + smtpServerURI = strings.Replace(imapServerURI, "imap.", "smtp.", 1) + } + wizard.smtpServer.Set(smtpServerURI) wizard.imapUri() wizard.smtpUri() })