<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>48461</bug_id>
          
          <creation_ts>2002-09-29 18:59:19 +0000</creation_ts>
          <short_desc>kmail should remember smtp password</short_desc>
          <delta_ts>2007-09-14 12:17:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>kmail</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>RedHat Enterprise Linux</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>wishlist</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ali Bayazit">test1</reporter>
          <assigned_to name="kdepim bugs">pim-bugs-null</assigned_to>
          <cc>kdebugs</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>86</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>96644</commentid>
    <comment_count>0</comment_count>
    <who name="Ali Bayazit">test1</who>
    <bug_when>2002-09-29 18:59:19 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.0)
Installed from:    RedHat RPMs

Unlike pop or imap passwords, kde cannot remember smtp passwords. I do not check &quot;store password in configuration file&quot; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96658</commentid>
    <comment_count>1</comment_count>
    <who name="Ingo Klöcker">kloecker</who>
    <bug_when>2002-09-29 20:38:19 +0000</bug_when>
    <thetext>I&apos;d also like to see this implemented. 
 </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160532</commentid>
    <comment_count>2</comment_count>
    <who name="Ladislav Strojil">ladislav.strojil</who>
    <bug_when>2003-09-22 11:27:06 +0000</bug_when>
    <thetext>KMail now supports saving SMTP password in its configuration file. Please upgrade if 
you haven&apos;t done already so. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>255527</commentid>
    <comment_count>3</comment_count>
    <who name="Erik Schnetter">schnetter</who>
    <bug_when>2004-08-03 10:59:52 +0000</bug_when>
    <thetext>I don&apos;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.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>255561</commentid>
    <comment_count>4</comment_count>
    <who name="Andreas Gungl">a.gungl</who>
    <bug_when>2004-08-03 13:24:57 +0000</bug_when>
    <thetext>The caching isn&apos;t fixed. That&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>361116</commentid>
    <comment_count>5</comment_count>
    <who name="Tony B">tonyb.sfkde</who>
    <bug_when>2005-07-28 17:14:20 +0000</bug_when>
    <thetext>Also, I would like to see an option that says POP and SMTP passwords are the same.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>367988</commentid>
    <comment_count>6</comment_count>
    <who name="">kdebugs</who>
    <bug_when>2005-08-23 06:02:52 +0000</bug_when>
    <thetext>Password should be cached. As said above, I would not like to have my password stored in the config file</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>447721</commentid>
    <comment_count>7</comment_count>
    <who name="Brad">nu2linux</who>
    <bug_when>2006-06-18 22:58:59 +0000</bug_when>
    <thetext>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.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>472988</commentid>
    <comment_count>8</comment_count>
    <who name="Raúl">rasasi78</who>
    <bug_when>2006-09-26 16:52:44 +0000</bug_when>
    <thetext>I also vote for this one and for the #5 proposal. This bug is somewhat old, and I don&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>508949</commentid>
    <comment_count>9</comment_count>
      <attachid>19666</attachid>
    <who name="Luigi Toscano">luigi.toscano</who>
    <bug_when>2007-02-13 18:27:46 +0000</bug_when>
    <thetext>Created attachment 19666
Proposed patch (tested on the 3.5.x branch)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>508957</commentid>
    <comment_count>10</comment_count>
    <who name="Allen Winter">winter</who>
    <bug_when>2007-02-13 18:45:27 +0000</bug_when>
    <thetext>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-&gt;unGetMsg( mFailedMessages );
       mCurrentMsg = 0;
       mFailedMessages++;
+      // reset cached password
+      QMapIterator &lt;QString,QString&gt; 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-&gt;auth)
   {
+    QMapIterator&lt;QString,QString&gt; tpc = mSender-&gt;mPasswdCache.find( ti-&gt;name );
+    QString tpwd = ( tpc != mSender-&gt;mPasswdCache.end() )?(*tpc):QString::null;
+
+    if ( ti-&gt;passwd().isEmpty() )
+      ti-&gt;setPasswd( tpwd );
+
     if( (ti-&gt;user.isEmpty() || ti-&gt;passwd().isEmpty()) &amp;&amp;
       ti-&gt;authType != &quot;GSSAPI&quot; )
     {
@@ -1113,6 +1124,9 @@
       if (int id = KMTransportInfo::findTransport(ti-&gt;name)) {
         ti-&gt;setPasswd( passwd );
         ti-&gt;writeConfig(id);
+
+        // save the password into the cache
+        mSender-&gt;mPasswdCache[ti-&gt;name] = passwd;
       }
     }
     destination.setUser(ti-&gt;user);
--- branches/work/kdepim-3.5.5+/kmail/kmsender.h #633275:633276
@@ -30,6 +30,7 @@
 #include &lt;qcstring.h&gt;
 #include &lt;qstring.h&gt;
 #include &lt;qstringlist.h&gt;
+#include &lt;qmap.h&gt;
 #include &lt;qobject.h&gt;
 #include &lt;kdeversion.h&gt;
 
@@ -167,6 +168,7 @@
   int mSentMessages, mTotalMessages;
   int mSentBytes, mTotalBytes;
   int mFailedMessages;
+  QMap&lt;QString,QString&gt; mPasswdCache;
 };
 
 #endif /*kmsender_h*/
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>520601</commentid>
    <comment_count>11</comment_count>
    <who name="Allen Winter">winter</who>
    <bug_when>2007-04-14 16:07:35 +0000</bug_when>
    <thetext>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-&gt;unGetMsg( mFailedMessages );
       mCurrentMsg = 0;
       mFailedMessages++;
+      // reset cached password
+      QMapIterator &lt;QString,QString&gt; 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-&gt;auth)
   {
+    QMapIterator&lt;QString,QString&gt; tpc = mSender-&gt;mPasswdCache.find( ti-&gt;name );
+    QString tpwd = ( tpc != mSender-&gt;mPasswdCache.end() )?(*tpc):QString::null;
+
+    if ( ti-&gt;passwd().isEmpty() )
+      ti-&gt;setPasswd( tpwd );
+
     if( (ti-&gt;user.isEmpty() || ti-&gt;passwd().isEmpty()) &amp;&amp;
       ti-&gt;authType != &quot;GSSAPI&quot; )
     {
@@ -1097,6 +1108,9 @@
       if (int id = KMTransportInfo::findTransport(ti-&gt;name)) {
         ti-&gt;setPasswd( passwd );
         ti-&gt;writeConfig(id);
+
+        // save the password into the cache
+        mSender-&gt;mPasswdCache[ti-&gt;name] = passwd;
       }
     }
     destination.setUser(ti-&gt;user);
--- branches/KDE/3.5/kdepim/kmail/kmsender.h #653891:653892
@@ -30,6 +30,7 @@
 #include &lt;qcstring.h&gt;
 #include &lt;qstring.h&gt;
 #include &lt;qstringlist.h&gt;
+#include &lt;qmap.h&gt;
 #include &lt;qobject.h&gt;
 #include &lt;kdeversion.h&gt;
 
@@ -167,6 +168,7 @@
   int mSentMessages, mTotalMessages;
   int mSentBytes, mTotalBytes;
   int mFailedMessages;
+  QMap&lt;QString,QString&gt; mPasswdCache;
 };
 
 #endif /*kmsender_h*/
</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>19666</attachid>
            <date>2007-02-13 18:27:46 +0000</date>
            <delta_ts>2007-02-13 18:27:46 +0000</delta_ts>
            <desc>Proposed patch (tested on the 3.5.x branch)</desc>
            <filename>kmail_patch_ok_nodebug</filename>
            <type>text/plain</type>
            <size>1749</size>
            <attacher name="Luigi Toscano">luigi.toscano</attacher>
            
              <data encoding="base64">SW5kZXg6IGttc2VuZGVyLmgKPT09PT09PT09PT09PT09PT09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GVbdGktPm5hbWVdID0gcGFzc3dkOwogICAgICAgfQogICAg
IH0KICAgICBkZXN0aW5hdGlvbi5zZXRVc2VyKHRpLT51c2VyKTsK
</data>

          </attachment>
      

    </bug>

</bugzilla>