Utente e password SMTP separati da quelli IMAP (0.24.7)

Alcuni server vogliono per l'invio un utente diverso (spesso l'indirizzo intero
invece del nome corto) e una password diversa. In Account ci sono ora due campi
dedicati; vuoti, restano validi l'utente SMTP dedotto e la password della posta.
This commit is contained in:
Carlo Baratto committed 2026-11-24 21:42:28 +01:00
1 parent e12a669b1e
commit 02b0f3e90d
6 files changed
+47 -7

No files matched your search

+12 -3
View File
@@ -44,6 +44,7 @@ void AccountSettings::loadUno(QSettings &s, int i)
d.smtpHost = s.value(g + "smtp_host").toString();
d.smtpPort = s.value(g + "smtp_port", 587).toInt();
d.smtpSecurity = s.value(g + "smtp_security", 1).toInt();
d.smtpUser = s.value(g + "smtp_user").toString();
d.smtpPassword = s.value(g + "smtp_password").toString();
d.keep = s.value(g + "keep", 500).toInt();
d.firma = s.value(g + "firma").toString();
@@ -80,6 +81,7 @@ void AccountSettings::load()
d.smtpHost = s.value(QStringLiteral("account/smtp_host")).toString();
d.smtpPort = s.value(QStringLiteral("account/smtp_port"), 587).toInt();
d.smtpSecurity = s.value(QStringLiteral("account/smtp_security"), 1).toInt();
d.smtpUser = s.value(QStringLiteral("account/smtp_user")).toString();
d.smtpPassword = s.value(QStringLiteral("account/smtp_password")).toString();
d.keep = s.value(QStringLiteral("account/keep"), 500).toInt();
d.firma = s.value(QStringLiteral("account/firma")).toString();
@@ -108,6 +110,7 @@ void AccountSettings::saveUno(QSettings &s, int i) const
s.setValue(g + "smtp_host", d.smtpHost);
s.setValue(g + "smtp_port", d.smtpPort);
s.setValue(g + "smtp_security", d.smtpSecurity);
s.setValue(g + "smtp_user", d.smtpUser);
s.setValue(g + "smtp_password", d.smtpPassword);
s.setValue(g + "keep", d.keep);
s.setValue(g + "firma", d.firma);
@@ -164,6 +167,8 @@ QString AccountSettings::password() const { return corrente().password; }
QString AccountSettings::smtpHost() const { return corrente().smtpHost; }
int AccountSettings::smtpPort() const { return corrente().smtpPort; }
int AccountSettings::smtpSecurity() const { return corrente().smtpSecurity; }
QString AccountSettings::smtpUser() const { return corrente().smtpUser; }
QString AccountSettings::smtpPassword() const { return corrente().smtpPassword; }
int AccountSettings::keep() const { return corrente().keep; }
QString AccountSettings::firma() const { return corrente().firma; }
QString AccountSettings::bookUrl() const { return corrente().bookUrl; }
@@ -180,6 +185,8 @@ void AccountSettings::setPassword(const QString &v) { if (corrente().password !=
void AccountSettings::setSmtpHost(const QString &v) { if (corrente().smtpHost != v) { corrente().smtpHost = v; emit changed(); } }
void AccountSettings::setSmtpPort(int v) { if (corrente().smtpPort != v) { corrente().smtpPort = v; emit changed(); } }
void AccountSettings::setSmtpSecurity(int v) { if (corrente().smtpSecurity != v) { corrente().smtpSecurity = v; emit changed(); } }
void AccountSettings::setSmtpUser(const QString &v) { if (corrente().smtpUser != v) { corrente().smtpUser = v; emit changed(); } }
void AccountSettings::setSmtpPassword(const QString &v) { if (corrente().smtpPassword != v) { corrente().smtpPassword = v; emit changed(); } }
void AccountSettings::setKeep(int v) { if (corrente().keep != v) { corrente().keep = v; emit changed(); } }
void AccountSettings::setFirma(const QString &v) { if (corrente().firma != v) { corrente().firma = v; emit changed(); } }
void AccountSettings::setBookUrl(const QString &v) { if (corrente().bookUrl != v) { corrente().bookUrl = v; emit changed(); } }
@@ -328,9 +335,11 @@ QString AccountSettings::rigaSmtp(const Dati &d)
// per SMTP vogliono l'indirizzo completo: con "carlo" rispondono
// "421 login denied". Se l'utente non ha la chiocciola e il mittente sì,
// all'autenticazione SMTP si manda il mittente; l'IMAP resta com'è.
const QString utenteSmtp =
(d.user.contains(QLatin1Char('@')) || !d.mittente.contains(QLatin1Char('@')))
? d.user : d.mittente;
// Se l'utente SMTP e' scritto in Account si usa quello, senza indovinare.
const QString utenteSmtp = d.smtpUser.trimmed().isEmpty()
? ((d.user.contains(QLatin1Char('@')) || !d.mittente.contains(QLatin1Char('@')))
? d.user : d.mittente)
: d.smtpUser.trimmed();
return QString("%1\t%2\t%3\t%4\t%5")
.arg(d.smtpHost, QString::number(d.smtpPort),
QString::number(d.smtpSecurity), utenteSmtp, d.smtpPassword);
+9 -1
View File
@@ -30,6 +30,10 @@ class AccountSettings : public QObject
Q_PROPERTY(QString smtpHost READ smtpHost WRITE setSmtpHost NOTIFY changed)
Q_PROPERTY(int smtpPort READ smtpPort WRITE setSmtpPort NOTIFY changed)
Q_PROPERTY(int smtpSecurity READ smtpSecurity WRITE setSmtpSecurity NOTIFY changed)
// Alcuni server vogliono un utente diverso per l'invio (o l'indirizzo
// intero invece del nome corto): vuoto = lo stesso dell'IMAP.
Q_PROPERTY(QString smtpUser READ smtpUser WRITE setSmtpUser NOTIFY changed)
Q_PROPERTY(QString smtpPassword READ smtpPassword WRITE setSmtpPassword NOTIFY changed)
Q_PROPERTY(int keep READ keep WRITE setKeep NOTIFY changed)
// Firma aggiunta ai messaggi nuovi (testo semplice).
Q_PROPERTY(QString firma READ firma WRITE setFirma NOTIFY changed)
@@ -54,6 +58,8 @@ public:
QString smtpHost() const;
int smtpPort() const;
int smtpSecurity() const;
QString smtpUser() const;
QString smtpPassword() const;
int keep() const;
QString firma() const;
QString bookUrl() const;
@@ -72,6 +78,8 @@ public:
void setSmtpHost(const QString &v);
void setSmtpPort(int v);
void setSmtpSecurity(int v);
void setSmtpUser(const QString &v);
void setSmtpPassword(const QString &v);
void setKeep(int v);
void setFirma(const QString &v);
void setBookUrl(const QString &v);
@@ -124,7 +132,7 @@ signals:
private:
struct Dati {
QString persona, mittente, imapHost, user, password;
QString smtpHost, smtpPassword;
QString smtpHost, smtpUser, smtpPassword;
QString bookUrl, bookUser, bookPassword;
QString firma;
QStringList stazioniNomi, stazioniTesti;
+2 -2
View File
@@ -32,9 +32,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
app->setOrganizationName(QStringLiteral("harbour"));
app->setApplicationName(QStringLiteral("grumpydove"));
app->setApplicationVersion(QStringLiteral("0.24.6"));
app->setApplicationVersion(QStringLiteral("0.24.7"));
qDebug() << "harbour-grumpydove v0.24.6 build" << __DATE__ << __TIME__;
qDebug() << "harbour-grumpydove v0.24.7 build" << __DATE__ << __TIME__;
// Maildir, log, rubrica e liste dei filtri nella cartella dati dell'app:
// la sandbox non lascia vedere ~/Mail né scrivere sotto HOME, e cambiare