[Kde-pim] Sending invitations to Outlook users

Jan-Pascal van Best janpascal at vanbest.org
Tue Feb 13 08:54:52 GMT 2007


Hi all,

Could someone using Outlook with Exchange try the following: replace in
kmail/callback.cpp the method Callback::mailICal with the version below.
It seems to work, but I cannot completely test it. I'm moving shortly,
and my Exchange server is in a temporary location where I can't connect
to it using Outlook. OWA (Outlook Web Access) shows the proper icon for
the invitation confirmation, but I cannot see the attendee status in OWA.

Basically, I've merged in the message building part from
KMKernel::openComposer into Callback::mailICal (it seems there is quite
some code duplication there, by the way). It looks like Exchange groks
the reply, but as I mentioned above, could someone using Outlook with
Exchange please test?

Cheers

Jan-Pascal


bool Callback::mailICal( const QString& to, const QString iCal,
                         const QString& subject ) const
{
  kdDebug(5006) << "Mailing message:\n" << iCal << endl;

  KMMessage *msg = new KMMessage;
  msg->initHeader();
  msg->setCharset( "utf-8" );

  if ( !subject.isEmpty() ) msg->setSubject( subject );
  if ( !to.isEmpty() ) msg->setTo( to );
  if ( !subject.isEmpty() ) msg->setFrom( receiver() );
  /* We want the triggering mail to be moved to the trash once this one
   * has been sent successfully. Set a link header which accomplishes
that. */
  msg->link( mMsg, KMMsgStatusDeleted );

  // Outlook will only understand the reply if the From: header is the
  // same as the To: header of the invitation message.
  KConfigGroup options( KMKernel::config(), "Groupware" );
  if( !options.readBoolEntry( "LegacyMangleFromToHeaders", true ) ) {
    // Try and match the receiver with an identity
    const KPIM::Identity& identity =
      kmkernel->identityManager()->identityForAddress( receiver() );
    if( identity != KPIM::Identity::null() )
      // Identity found. Use this
      msg->setFrom( identity.fullEmailAddr() );
      msg->setHeaderField("X-KMail-Identity", QString::number(
identity.uoid() ));
      // Remove BCC from identity on ical invitations
(https://intevation.de/roundup/kolab/issue474)
      msg->setBcc( "" );
  }

  KMMessagePart *msgPart = new KMMessagePart;
  msgPart->setName( "cal.ics" );
  // msgPart->setCteStr( attachCte ); // "base64" ?
  msgPart->setBodyEncoded( iCal.utf8() );
  msgPart->setTypeStr( "text" );
  msgPart->setSubtypeStr( "calendar" );
  msgPart->setParameter( "method", "reply" );
 
  KMail::Composer * cWin = KMail::makeComposer();
  cWin->setMsg( msg, false /* mayAutoSign */ );
  // cWin->setCharset( "", true );
  cWin->slotWordWrapToggled( false );
  cWin->setSigningAndEncryptionDisabled( true );
  cWin->addAttach(msgPart);

  if ( options.readBoolEntry( "AutomaticSending", true ) ) {
    cWin->setAutoDeleteWindow(  true );
    cWin->slotSendNow();
  } else {
    cWin->show();
  }

  return true;
}
_______________________________________________
kde-pim mailing list
kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/



More information about the kde-pim mailing list