Bug 48461 - kmail should remember smtp password
Summary: kmail should remember smtp password
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: RedHat RPMs Linux
: NOR wishlist with 86 votes (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-29 18:59 UTC by Ali Bayazit
Modified: 2007-09-14 12:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed patch (tested on the 3.5.x branch) (1.71 KB, patch)
2007-02-13 18:27 UTC, Luigi Toscano
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ali Bayazit 2002-09-29 18:59:19 UTC
Version:            (using KDE KDE 3.0)
Installed from:    RedHat RPMs

Unlike pop or imap passwords, kde cannot remember smtp passwords. I do not check "store password in configuration file" box, for security reasons. As a result every time I want to send an email, I have to reenter smtp auth password. I would like kde to store password in memory like pop or imap passwords. So I should only enter password once per session.
Comment 1 Ingo Klöcker 2002-09-29 20:38:19 UTC
I'd also like to see this implemented. 
 
Comment 2 Ladislav Strojil 2003-09-22 11:27:06 UTC
KMail now supports saving SMTP password in its configuration file. Please upgrade if 
you haven't done already so. 
Comment 3 Erik Schnetter 2004-08-03 10:59:52 UTC
I don't think that comment #2 answers the feature request of the original poster.  Ali wants kmail to remember the password per session, so that the password is not stored in a file (and all backups).  I would be very happy to see the same feature.
Comment 4 Andreas Gungl 2004-08-03 13:24:57 UTC
The caching isn't fixed. That's why I reopen the wish.

Caching should work like for receiving or for signing where you have to provide the password only once per KMail session. Storing the password in the config file is not really related.
Comment 5 Tony B 2005-07-28 17:14:20 UTC
Also, I would like to see an option that says POP and SMTP passwords are the same.
Comment 6 kdebugs 2005-08-23 06:02:52 UTC
Password should be cached. As said above, I would not like to have my password stored in the config file
Comment 7 Brad 2006-06-18 22:58:59 UTC
I am using KDE 3.5.1 level a. on a SUSE 10.1 Linux distribution and this SMTP password bug is not fixed as yet. Everything I have tried does not work everytime I send an email I am asked whether or not I want to save my password to a configuration file and I say yes and it never saves it.
Comment 8 Raúl 2006-09-26 16:52:44 UTC
I also vote for this one and for the #5 proposal. This bug is somewhat old, and I don't that implementing this could be difficult.

Just for general interest, thunderbird has already this option, and I also would like that my favourite mail reading app has it.

Thank you.
Comment 9 Luigi Toscano 2007-02-13 18:27:46 UTC
Created attachment 19666 [details]
Proposed patch (tested on the 3.5.x branch)
Comment 10 Allen Winter 2007-02-13 18:45:27 UTC
SVN commit 633276 by winterz:

Make KMail remember the SMTP password.
Thanks for the patch Luigi.

CCBUGS: 48461


 M  +14 -0     branches/work/kdepim-3.5.5+/kmail/kmsender.cpp  
 M  +2 -0      branches/work/kdepim-3.5.5+/kmail/kmsender.h  


--- branches/work/kdepim-3.5.5+/kmail/kmsender.cpp #633275:633276
@@ -723,6 +723,11 @@
         mOutboxFolder->unGetMsg( mFailedMessages );
       mCurrentMsg = 0;
       mFailedMessages++;
+      // reset cached password
+      QMapIterator <QString,QString> pc;
+      if ( (pc = mPasswdCache.find( mMethodStr )) != mPasswdCache.end() ) {
+        mPasswdCache.erase(pc);
+      }
       // Sending of message failed.
       if (!errString.isEmpty()) {
         int res = KMessageBox::Yes;
@@ -1093,6 +1098,12 @@
 
   if (ti->auth)
   {
+    QMapIterator<QString,QString> tpc = mSender->mPasswdCache.find( ti->name );
+    QString tpwd = ( tpc != mSender->mPasswdCache.end() )?(*tpc):QString::null;
+
+    if ( ti->passwd().isEmpty() )
+      ti->setPasswd( tpwd );
+
     if( (ti->user.isEmpty() || ti->passwd().isEmpty()) &&
       ti->authType != "GSSAPI" )
     {
@@ -1113,6 +1124,9 @@
       if (int id = KMTransportInfo::findTransport(ti->name)) {
         ti->setPasswd( passwd );
         ti->writeConfig(id);
+
+        // save the password into the cache
+        mSender->mPasswdCache[ti->name] = passwd;
       }
     }
     destination.setUser(ti->user);
--- branches/work/kdepim-3.5.5+/kmail/kmsender.h #633275:633276
@@ -30,6 +30,7 @@
 #include <qcstring.h>
 #include <qstring.h>
 #include <qstringlist.h>
+#include <qmap.h>
 #include <qobject.h>
 #include <kdeversion.h>
 
@@ -167,6 +168,7 @@
   int mSentMessages, mTotalMessages;
   int mSentBytes, mTotalBytes;
   int mFailedMessages;
+  QMap<QString,QString> mPasswdCache;
 };
 
 #endif /*kmsender_h*/
Comment 11 Allen Winter 2007-04-14 16:07:35 UTC
SVN commit 653892 by winterz:

merge SVN commit 633276 by winterz: 
 
 Make KMail remember the SMTP password. 
 Thanks for the patch Luigi. 
 
BUGS: 48461 
 



 M  +14 -0     kmsender.cpp  
 M  +2 -0      kmsender.h  


--- branches/KDE/3.5/kdepim/kmail/kmsender.cpp #653891:653892
@@ -707,6 +707,11 @@
         mOutboxFolder->unGetMsg( mFailedMessages );
       mCurrentMsg = 0;
       mFailedMessages++;
+      // reset cached password
+      QMapIterator <QString,QString> pc;
+      if ( (pc = mPasswdCache.find( mMethodStr )) != mPasswdCache.end() ) {
+        mPasswdCache.erase(pc);
+      }
       // Sending of message failed.
       if (!errString.isEmpty()) {
         int res = KMessageBox::Yes;
@@ -1077,6 +1082,12 @@
 
   if (ti->auth)
   {
+    QMapIterator<QString,QString> tpc = mSender->mPasswdCache.find( ti->name );
+    QString tpwd = ( tpc != mSender->mPasswdCache.end() )?(*tpc):QString::null;
+
+    if ( ti->passwd().isEmpty() )
+      ti->setPasswd( tpwd );
+
     if( (ti->user.isEmpty() || ti->passwd().isEmpty()) &&
       ti->authType != "GSSAPI" )
     {
@@ -1097,6 +1108,9 @@
       if (int id = KMTransportInfo::findTransport(ti->name)) {
         ti->setPasswd( passwd );
         ti->writeConfig(id);
+
+        // save the password into the cache
+        mSender->mPasswdCache[ti->name] = passwd;
       }
     }
     destination.setUser(ti->user);
--- branches/KDE/3.5/kdepim/kmail/kmsender.h #653891:653892
@@ -30,6 +30,7 @@
 #include <qcstring.h>
 #include <qstring.h>
 #include <qstringlist.h>
+#include <qmap.h>
 #include <qobject.h>
 #include <kdeversion.h>
 
@@ -167,6 +168,7 @@
   int mSentMessages, mTotalMessages;
   int mSentBytes, mTotalBytes;
   int mFailedMessages;
+  QMap<QString,QString> mPasswdCache;
 };
 
 #endif /*kmsender_h*/