Index: kmmessage.cpp
===================================================================
--- kmmessage.cpp	(revision 758321)
+++ kmmessage.cpp	(working copy)
@@ -63,6 +63,7 @@
 #include <mimelib/string.h>
 #include <assert.h>
 #include <sys/time.h>
+#include <sys/utsname.h>
 #include <time.h>
 #include <klocale.h>
 #include <stdlib.h>
@@ -1672,6 +1673,32 @@
     setTemplates( ident.templates() );
 }
 
+// helper
+static void systemNameVersionAndMachine(QString& sysNameAndVersion, QString& machine)
+{
+  struct utsname unameBuf;
+  uname( &unameBuf );
+#ifdef Q_WS_WIN
+  sysNameAndVersion = QString::fromLatin1( "Windows" );
+  OSVERSIONINFOEX versioninfo;
+  ZeroMemory(&versioninfo, sizeof(OSVERSIONINFOEX));
+  // Try calling GetVersionEx using the OSVERSIONINFOEX, if that fails, try using the OSVERSIONINFO
+  versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+  bool ok = GetVersionEx( (OSVERSIONINFO *) &versioninfo );
+  if ( !ok ) {
+    versioninfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+    ok = GetVersionEx( (OSVERSIONINFO *) &versioninfo );
+  }
+  if ( ok )
+    sysNameAndVersion += QString::fromLatin1("/%1.%2")
+      .arg(versioninfo.dwMajorVersion).arg(versioninfo.dwMinorVersion);
+#else
+  sysNameAndVersion = QString::fromLatin1("%1/%2")
+    .arg(unameBuf.sysname).arg(unameBuf.release);
+#endif
+  machine = unameBuf.machine;
+}
+
 //-----------------------------------------------------------------------------
 void KMMessage::initHeader( uint id )
 {
@@ -1680,7 +1707,15 @@
   setSubject("");
   setDateToday();
 
-  setHeaderField("User-Agent", "KMail/" KMAIL_VERSION );
+  // user agent, e.g. KMail/1.9.50 (Windows/5.0; KDE/3.97.1; i686)
+  // todo: add SVN revision?
+  QString sysNameAndVersion, machine;
+  systemNameVersionAndMachine(sysNameAndVersion, machine);
+  setHeaderField("User-Agent", 
+    QString::fromLatin1( "KMail/" KMAIL_VERSION " (%1; KDE/%2.%3.%4; %5)" )
+    .arg( sysNameAndVersion ).arg( KDE::versionMajor() )
+    .arg( KDE::versionMinor() ).arg( KDE::versionRelease() ).arg( machine ) );
+
   // This will allow to change Content-Type:
   setHeaderField("Content-Type","text/plain");
 }
