email/pop3andsmtpmtm/clientmtms/test/src/T_imcm02c.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name of test harness: T_IMCM02C
       
    15 // Component: IMCM
       
    16 // Owner: KP
       
    17 // Brief description of test harness:
       
    18 // Tests CImEmailOperation - creates forward plaintext/HTML message 
       
    19 // with/without attachments; forward HTML message with no text alternative. 
       
    20 // Also tests adding VCard and signature from the SMTP settings.
       
    21 // Detailed description of test harness:
       
    22 // As above
       
    23 // Input files required to run test harness:
       
    24 // \MSG\IMCMTSRC\contacts.cdb					<DRIVE>:\system\data\contacts.cdb
       
    25 // \MSG\IMCMTSRC\T_IMCM02C_Entry_Structure.txt	<DRIVE>:\msgtest\IMCM\T_IMCM02C_Entry_Structure.txt
       
    26 // \MSG\IMCMTSRC\rfc82201.txt					<DRIVE>:\msgtest\IMCM\rfc82201.txt
       
    27 // \MSG\IMCMTSRC\rfc82202.txt					<DRIVE>:\msgtest\IMCM\rfc82202.txt
       
    28 // \MSG\IMCMTSRC\rfc82203.txt					<DRIVE>:\msgtest\IMCM\rfc82203.txt
       
    29 // \MSG\IMCMTSRC\rfc82204.txt					<DRIVE>:\msgtest\IMCM\rfc82204.txt
       
    30 // \MSG\IMCMTSRC\rfc82205.txt					<DRIVE>:\msgtest\IMCM\rfc82205.txt
       
    31 // \MSG\IMCMTSRC\rfc82206.txt					<DRIVE>:\msgtest\IMCM\rfc82206.txt
       
    32 // Intermediate files produced while running test harness:
       
    33 // <DRIVE>:\msglogs\T_IMCM02C\Entry_Structure.txt
       
    34 // Output files produced by running test harness:
       
    35 // <DRIVE>:\msglogs\T_IMCM02C.<PLATFORM>.<VARIANT>.LOG.txt
       
    36 // Description of how to build test harness:
       
    37 // cd \msg\imcm\
       
    38 // bldmake bldfiles
       
    39 // abld test build
       
    40 // Description of how to run test harness:
       
    41 // The following instructions are the same for all platforms:
       
    42 // 1. Build T_DB test harness from COMMDB component:
       
    43 // cd \commdb\group
       
    44 // bldmake bldfiles
       
    45 // abld test build t_db
       
    46 // 2. Build the test utilities:
       
    47 // cd \msg\testutils\group\
       
    48 // bldmake bldfiles
       
    49 // abld build
       
    50 // WINS running instructions:
       
    51 // 1. \epoc32\release\wins\<VARIANT>\T_IMCM02C.exe can be used at the command prompt
       
    52 // or executable can be run from Windows Explorer.
       
    53 // All other platform running instructions:
       
    54 // 1. Copy \epoc32\release\<PLATFORM>\<VARIANT>\T_IMCM02C.exe onto the other platform
       
    55 // 2. Copy \epoc32\release\<PLATFORM>\<VARIANT>\MSVTESTUTILS.DLL into 
       
    56 // <DRIVE>:\system\libs on the other platform
       
    57 // 3. Copy \epoc32\release\<PLATFORM>\<VARIANT>\EMAILTESTUTILS.DLL into 
       
    58 // <DRIVE>:\system\libs on the other platform
       
    59 // 4. Run T_IMCM02C.exe on the other platform
       
    60 // 
       
    61 //
       
    62 
       
    63 #include "emailtestutils.h"
       
    64 
       
    65 #include <miutmsg.h>
       
    66 
       
    67 
       
    68 #include <apfrec.h>
       
    69 #include <apgicnfl.h>
       
    70 #include <cemailaccounts.h>
       
    71 
       
    72 #include <cntdb.h>
       
    73 
       
    74 // local variables etc //
       
    75 
       
    76 
       
    77 _LIT(KImcm02Test, "T_IMCM02c - CImEmailOperation Tests");
       
    78 RTest test(KImcm02Test);
       
    79 
       
    80 LOCAL_D CTrapCleanup* theCleanup;
       
    81 
       
    82 LOCAL_D TMsvId pop3Service;
       
    83 LOCAL_D TMsvId smtpService;
       
    84 LOCAL_D CEmailTestUtils* testUtils;
       
    85 LOCAL_D CMsvEntrySelection* messageSelection;
       
    86 LOCAL_D TInt testNo = 1;
       
    87 LOCAL_D TBool testFailed=EFalse;
       
    88 
       
    89 #define KComponent				_L("IMCM")
       
    90 #define KTestMessageDir			_L("")
       
    91 #define KOkFileNameEntryStructure _L("T_IMCM02c_Entry_Structure.txt")
       
    92 
       
    93 LOCAL_D TBool StartTimeSet=EFalse;
       
    94 LOCAL_D TTime StartTime;
       
    95 LOCAL_D TInt  KnownDateTimeIndex=0;
       
    96 
       
    97 LOCAL_C void SetKnownDateAndTime()
       
    98 	{
       
    99 	TDateTime aDateTimes[]={
       
   100 				TDateTime(2002,EJune,18,10,30,0,0),
       
   101 				TDateTime(2003,EJanuary,1,21,0,0,0),
       
   102 				TDateTime(2001,EDecember,18,2,15,0,0),
       
   103 				TDateTime(2004,EMay,18,17,50,0,0)
       
   104 				};
       
   105 	if (!StartTimeSet)
       
   106 		{
       
   107 		StartTime.UniversalTime();
       
   108 		StartTimeSet=ETrue;
       
   109 		}
       
   110 	TTime aFakeTime(aDateTimes[KnownDateTimeIndex++]);
       
   111 	KnownDateTimeIndex&=3;
       
   112 	User::SetHomeTime(aFakeTime);
       
   113 	}
       
   114 
       
   115 LOCAL_C void RestoreDateAndTime()
       
   116 	{
       
   117 	if (StartTimeSet)
       
   118 		{
       
   119 		TTime aCurrentTime;
       
   120 		aCurrentTime.UniversalTime();
       
   121 		TTimeIntervalSeconds aDuration;
       
   122 		if (!aCurrentTime.SecondsFrom(StartTime,aDuration))
       
   123 			StartTime+=aDuration;
       
   124 		User::SetHomeTime(StartTime);
       
   125 		StartTimeSet=EFalse;
       
   126 		}
       
   127 	}
       
   128 
       
   129 LOCAL_C void InitL()
       
   130 	{
       
   131 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
   132 	CActiveScheduler::Install(scheduler);
       
   133 	CleanupStack::PushL(scheduler);
       
   134 
       
   135 	testUtils = CEmailTestUtils::NewLC(test);
       
   136 	testUtils->CreateAllTestDirectories();
       
   137 	CContactDatabase* contacts(NULL);
       
   138 	TRAPD(err, contacts = CContactDatabase::OpenL());
       
   139 	delete contacts;
       
   140 	if (err==KErrNotFound)
       
   141 		{
       
   142 		testUtils->WriteComment(_L("contacts file is missing from system data"));		
       
   143 		testFailed=ETrue;
       
   144 		return;
       
   145 		}
       
   146 	testUtils->FileSession().SetSessionPath(_L("C:\\"));
       
   147 	testUtils->ClearEmailAccountsL();
       
   148 	testUtils->CleanMessageFolderL();
       
   149 	testUtils->GoServerSideL();
       
   150 
       
   151 	testUtils->WriteComment(_L("CImEmailOperation Tests"));
       
   152 	}
       
   153 	
       
   154 LOCAL_C void Closedown()
       
   155 	{
       
   156 	CleanupStack::PopAndDestroy(2);  //testUtils, scheduler
       
   157 	User::After(5000000);
       
   158 	}
       
   159 
       
   160 
       
   161 LOCAL_C void CreateForwardL(TMsvId aMessageId, TMsvPartList aPartList, TMsvEmailTypeList aMsvEmailTypeList, TInt aTestNo)
       
   162 	{
       
   163 	testUtils->TestStart(aTestNo);
       
   164 	CTestActive* testActive = new (ELeave) CTestActive();
       
   165 	CleanupStack::PushL(testActive);
       
   166 
       
   167 	CImEmailOperation* emailOperation = CImEmailOperation::CreateForwardL(testActive->iStatus, *(testUtils->iMsvSession), aMessageId, KMsvGlobalOutBoxIndexEntryId, aPartList, aMsvEmailTypeList, KUidMsgTypeSMTP);
       
   168 	CleanupStack::PushL(emailOperation);
       
   169 
       
   170 	testActive->StartL();
       
   171 	CActiveScheduler::Start();
       
   172 	testUtils->TestFinish(aTestNo,testActive->iStatus.Int());
       
   173 
       
   174 	CleanupStack::PopAndDestroy(2); // testActive, emailOperation
       
   175 	}
       
   176 
       
   177 LOCAL_C void SetAddVCardToEmailL(TBool addVCard, TMsvId serviceId)
       
   178 	{
       
   179 	CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
       
   180 	CleanupStack::PushL(smtpSettings);
       
   181 
       
   182 	CEmailAccounts* accounts = CEmailAccounts::NewLC();	
       
   183 	TSmtpAccount account;
       
   184 	accounts->GetSmtpAccountL(serviceId, account);
       
   185   	accounts->LoadSmtpSettingsL(account, *smtpSettings);
       
   186 
       
   187 	smtpSettings->SetAddVCardToEmail(addVCard);
       
   188 	accounts->SaveSmtpSettingsL(account, *smtpSettings);
       
   189 	
       
   190 	CleanupStack::PopAndDestroy(2); // smtpSettings, msvStore/accounts
       
   191 	}
       
   192 
       
   193 LOCAL_C void CreateSignatureL(TMsvId serviceId)
       
   194 	{
       
   195 	testUtils->iMsvEntry->SetEntryL(serviceId);
       
   196 	CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL();
       
   197 	CleanupStack::PushL(paraFormatLayer);
       
   198 
       
   199 	CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); 
       
   200 	CleanupStack::PushL(charFormatLayer);
       
   201 
       
   202 	CRichText* signature=CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256);
       
   203 	CleanupStack::PushL(signature);
       
   204 
       
   205 	TBuf<100> bodyContents = _L("(Signature:) Symbian Ltd.");
       
   206 	signature->InsertL(0, bodyContents);
       
   207 
       
   208 	CMsvStore* msvStore = testUtils->iMsvEntry->EditStoreL();
       
   209 	CleanupStack::PushL(msvStore);
       
   210 	
       
   211 	msvStore->StoreBodyTextL(*signature);
       
   212 	msvStore->Commit();
       
   213 	CleanupStack::PopAndDestroy(4); // msvStore, signature, charFormatLayer, paraFormatLayer
       
   214 	}
       
   215 
       
   216 LOCAL_C void SetSignatureToEmailL(TBool addSignature, TMsvId serviceId)
       
   217 	{
       
   218 	CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
       
   219 	CleanupStack::PushL(smtpSettings);
       
   220 
       
   221 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
   222 	TSmtpAccount account;
       
   223 	accounts->GetSmtpAccountL(serviceId, account);
       
   224 	accounts->LoadSmtpSettingsL(account, *smtpSettings);
       
   225 
       
   226 	accounts->LoadSmtpSettingsL(account,*smtpSettings);
       
   227 	smtpSettings->SetAddSignatureToEmail(addSignature);
       
   228 	accounts->SaveSmtpSettingsL(account, *smtpSettings);
       
   229 	
       
   230 	CleanupStack::PopAndDestroy(2); // smtpSettings, msvStore/accounts
       
   231 
       
   232 	if (addSignature)
       
   233 		testUtils->WriteComment(_L("\tAdd VCard"));
       
   234 	}
       
   235 
       
   236 
       
   237 LOCAL_C void SetDefaultServiceL(TMsvId smtpService)
       
   238 	{
       
   239 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
   240 	TSmtpAccount account;
       
   241 	accounts->GetSmtpAccountL(smtpService, account);
       
   242 	accounts->SetDefaultSmtpAccountL(account);
       
   243 	// is default service ??
       
   244 	TSmtpAccount defaultAccount;
       
   245 	accounts->DefaultSmtpAccountL(defaultAccount);
       
   246 	if (smtpService != defaultAccount.iSmtpService)
       
   247 		{
       
   248 		User::Leave(KErrNotFound);
       
   249 		}
       
   250 	CleanupStack::PopAndDestroy(accounts);
       
   251 	}
       
   252 
       
   253 LOCAL_C void SetIncludeToCcL(TInt aInt, TMsvId serviceId)
       
   254 	{
       
   255 	CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
       
   256 	CleanupStack::PushL(smtpSettings);
       
   257 
       
   258 	CEmailAccounts* accounts = CEmailAccounts::NewLC();
       
   259 	TSmtpAccount smtpAccount;
       
   260 	accounts->GetSmtpAccountL(serviceId, smtpAccount);
       
   261 	accounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings);
       
   262 
       
   263 	smtpSettings->SetToCcIncludeLimitL(aInt);
       
   264 	
       
   265 	accounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings);
       
   266 
       
   267 	CleanupStack::PopAndDestroy(2); // smtpSettings, msvStore/accounts
       
   268 	}
       
   269 
       
   270 LOCAL_C void DoPlaintextCreateForwardTestsL(TMsvId aMessageId)
       
   271 	{
       
   272 	TMsvPartList partList = 0;
       
   273 	TMsvEmailTypeList emailTypeList = 0;
       
   274 
       
   275 	//
       
   276 	// Plaintext messages
       
   277 	//
       
   278 	testUtils->WriteComment(_L("\tPlaintext Create Forward Message Tests"));
       
   279 
       
   280 	// basic new message with nothing!
       
   281 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   282 
       
   283 	// only body
       
   284 	partList = KMsvMessagePartBody;
       
   285 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   286 
       
   287 	// only attachment
       
   288 	partList = KMsvMessagePartAttachments;
       
   289 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   290 
       
   291 	// only body and attachment
       
   292 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   293 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   294 
       
   295 	// basic new message with subject
       
   296 	partList = KMsvMessagePartDescription;
       
   297 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   298 
       
   299 	// only body and subject
       
   300 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   301 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   302 
       
   303 	// only attachment and subject
       
   304 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   305 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   306 
       
   307 	// only body, attachment and subject 
       
   308 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   309 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   310 
       
   311 	// basic new message with originator
       
   312 	partList = KMsvMessagePartOriginator;
       
   313 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   314 
       
   315 	// only body and originator
       
   316 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   317 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   318 
       
   319 	// only attachment and originator
       
   320 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   321 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   322 
       
   323 	// only body, attachment and originator
       
   324 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   325 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   326 
       
   327 	// basic new message with subject and originator
       
   328 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   329 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   330 
       
   331 	// only body, subject and originator
       
   332 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   333 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   334 
       
   335 	// only attachment, subject and originator
       
   336 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   337 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   338 
       
   339 	// only body, attachment, subject and originator
       
   340 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   341 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   342 
       
   343 	// basic new message with recipients
       
   344 	partList = KMsvMessagePartRecipient;
       
   345 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   346 
       
   347 	// only body and recipients
       
   348 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   349 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   350 
       
   351 	// only attachment and recipients
       
   352 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   353 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   354 
       
   355 	// only body, attachment and recipients
       
   356 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   357 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   358 
       
   359 	// basic new message with subject and recipients
       
   360 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   361 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   362 
       
   363 	// only body, subject and recipients
       
   364 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   365 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   366 
       
   367 	// only attachment, subject and recipients
       
   368 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   369 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   370 
       
   371 	// only body, attachment, subject and recipients
       
   372 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   373 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   374 
       
   375 	// basic new message with originator and recipients
       
   376 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   377 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   378 
       
   379 	// only body, originator and recipients
       
   380 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   381 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   382 
       
   383 	// only attachment, originator and recipients
       
   384 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   385 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   386 
       
   387 	// only body, attachment, originator and recipients
       
   388 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   389 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   390 
       
   391 	// basic new message with subject, originator and recipients
       
   392 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   393 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   394 
       
   395 	// only body, subject, originator and recipients
       
   396 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   397 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   398 
       
   399 	// only attachment, subject, originator and recipients
       
   400 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   401 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   402 
       
   403 	// only body, attachment, subject, originator and recipients
       
   404 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   405 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   406 
       
   407 	// Create a VCard and store in the SMTP settings
       
   408 	SetAddVCardToEmailL(ETrue, smtpService);
       
   409 	testUtils->WriteComment(_L("\tPlaintext Create Forward Message with VCard Tests"));
       
   410 
       
   411 	// basic new message with VCard
       
   412 	partList = 0;
       
   413 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   414 
       
   415 	// only body and VCard
       
   416 	partList = KMsvMessagePartBody;
       
   417 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   418 
       
   419 	// only attachment and VCard
       
   420 	partList = KMsvMessagePartAttachments;
       
   421 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   422 
       
   423 	// only body, attachment and VCard
       
   424 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   425 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   426 
       
   427 	// basic new message with subject and VCard
       
   428 	partList = KMsvMessagePartDescription;
       
   429 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   430 
       
   431 	// only body, subject and VCard
       
   432 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   433 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   434 
       
   435 	// only attachment, subject and VCard
       
   436 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   437 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   438 
       
   439 	// only body, attachment, subject and VCard
       
   440 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   441 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   442 
       
   443 	// basic new message with originator and VCard
       
   444 	partList = KMsvMessagePartOriginator;
       
   445 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   446 
       
   447 	// only body, originator and VCard
       
   448 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   449 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   450 
       
   451 	// only attachment, originator and VCard
       
   452 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   453 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   454 
       
   455 	// only body, attachment, originator and VCard
       
   456 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   457 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   458 
       
   459 	// basic new message with subject, originator and VCard
       
   460 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   461 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   462 
       
   463 	// only body, subject, originator and VCard
       
   464 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   465 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   466 
       
   467 	// only attachment, subject, originator and VCard
       
   468 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   469 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   470 
       
   471 	// only body, attachment, subject, originator and VCard
       
   472 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   473 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   474 
       
   475 	// basic new message with recipients and VCard
       
   476 	partList = KMsvMessagePartRecipient;
       
   477 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   478 
       
   479 	// only body, recipients and VCard
       
   480 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   481 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   482 
       
   483 	// only attachment, recipients and VCard
       
   484 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   485 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   486 
       
   487 	// only body, attachment, recipients and VCard
       
   488 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   489 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   490 
       
   491 	// basic new message with subject, recipients and VCard
       
   492 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   493 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   494 
       
   495 	// only body, subject, recipients and VCard
       
   496 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   497 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   498 
       
   499 	// only attachment, subject, recipients and VCard
       
   500 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   501 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   502 
       
   503 	// only body, attachment, subject, recipients and VCard
       
   504 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   505 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   506 
       
   507 	// basic new message with originator, recipients and VCard
       
   508 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   509 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   510 
       
   511 	// only body, originator, recipients and VCard
       
   512 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   513 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   514 
       
   515 	// only attachment, originator, recipients and VCard
       
   516 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   517 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   518 
       
   519 	// only body, attachment, originator, recipients and VCard
       
   520 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   521 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   522 
       
   523 	// basic new message with subject, originator, recipients and VCard
       
   524 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   525 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   526 
       
   527 	// only body, subject, originator, recipients and VCard
       
   528 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   529 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   530 
       
   531 	// only attachment, subject, originator, recipients and VCard
       
   532 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   533 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   534 
       
   535 	// only body, attachment, subject, originator, recipients and VCard
       
   536 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   537 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   538 
       
   539 	// Store signature in the SMTP settings
       
   540 	SetAddVCardToEmailL(EFalse, smtpService);
       
   541 	CreateSignatureL(smtpService);
       
   542 	SetSignatureToEmailL(ETrue, smtpService);
       
   543 	testUtils->WriteComment(_L("\tPlaintext Create Forward Message with signature Tests"));
       
   544 
       
   545 	// basic new message with signature!
       
   546 	partList = 0;
       
   547 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   548 
       
   549 	// only body and signature
       
   550 	partList = KMsvMessagePartBody;
       
   551 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   552 
       
   553 	// only attachment and signature
       
   554 	partList = KMsvMessagePartAttachments;
       
   555 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   556 
       
   557 	// only body, attachment and signature
       
   558 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   559 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   560 
       
   561 	// basic new message with subject and signature
       
   562 	partList = KMsvMessagePartDescription;
       
   563 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   564 
       
   565 	// only body, subject and signature
       
   566 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   567 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   568 
       
   569 	// only attachment, subject and signature
       
   570 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   571 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   572 
       
   573 	// only body, attachment, subject and signature
       
   574 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   575 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   576 
       
   577 	// basic new message with originator and signature
       
   578 	partList = KMsvMessagePartOriginator;
       
   579 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   580 
       
   581 	// only body, originator and signature
       
   582 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   583 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   584 
       
   585 	// only attachment, originator and signature
       
   586 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   587 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   588 
       
   589 	// only body, attachment, originator and signature
       
   590 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   591 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   592 
       
   593 	// basic new message with subject, originator and signature
       
   594 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   595 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   596 
       
   597 	// only body, subject, originator and signature
       
   598 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   599 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   600 
       
   601 	// only attachment, subject, originator and signature
       
   602 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   603 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   604 
       
   605 	// only body, attachment, subject, originator and signature
       
   606 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   607 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   608 
       
   609 	// basic new message with recipients and signature
       
   610 	partList = KMsvMessagePartRecipient;
       
   611 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   612 
       
   613 	// only body, recipients and signature
       
   614 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   615 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   616 
       
   617 	// only attachment, recipients and signature
       
   618 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   619 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   620 
       
   621 	// only body, attachment, recipients and signature
       
   622 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   623 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   624 
       
   625 	// basic new message with subject, recipients and signature
       
   626 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   627 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   628 
       
   629 	// only body, subject, recipients and signature
       
   630 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   631 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   632 
       
   633 	// only attachment, subject, recipients and signature
       
   634 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   635 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   636 
       
   637 	// only body, attachment, subject, recipients and signature
       
   638 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   639 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   640 
       
   641 	// basic new message with originator, recipients and signature
       
   642 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   643 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   644 
       
   645 	// only body, originator, recipients and signature
       
   646 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   647 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   648 
       
   649 	// only attachment, originator, recipients and signature
       
   650 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   651 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   652 
       
   653 	// only body, attachment, originator, recipients and signature
       
   654 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   655 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   656 
       
   657 	// basic new message with subject, originator, recipients and signature
       
   658 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   659 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   660 
       
   661 	// only body, subject, originator, recipients and signature
       
   662 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   663 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   664 
       
   665 	// only attachment, subject, originator, recipients and signature
       
   666 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   667 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   668 
       
   669 	// only body, attachment, subject, originator, recipients and signature
       
   670 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   671 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   672 
       
   673 	// Create a VCard and store in the SMTP settings
       
   674 	SetAddVCardToEmailL(ETrue, smtpService);
       
   675 	testUtils->WriteComment(_L("\tPlaintext Create Forward Message with VCard and signature Tests"));
       
   676 
       
   677 	// basic new message with VCard and Signature!
       
   678 	partList = 0;
       
   679 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   680 
       
   681 	// only body, VCard and Signature
       
   682 	partList = KMsvMessagePartBody;
       
   683 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   684 
       
   685 	// only attachment, VCard and Signature
       
   686 	partList = KMsvMessagePartAttachments;
       
   687 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   688 
       
   689 	// only body, attachment, VCard and Signature
       
   690 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments;
       
   691 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   692 
       
   693 	// basic new message with subject, VCard and Signature
       
   694 	partList = KMsvMessagePartDescription;
       
   695 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   696 
       
   697 	// only body, subject, VCard and Signature
       
   698 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   699 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   700 
       
   701 	// only attachment, subject, VCard and Signature
       
   702 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   703 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   704 
       
   705 	// only body, attachment, subject, VCard and Signature
       
   706 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   707 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   708 
       
   709 	// basic new message with originator, VCard and Signature
       
   710 	partList = KMsvMessagePartOriginator;
       
   711 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   712 
       
   713 	// only body, originator, VCard and Signature
       
   714 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator;
       
   715 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   716 
       
   717 	// only attachment, originator, VCard and Signature
       
   718 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   719 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   720 
       
   721 	// only body, attachment, originator, VCard and Signature
       
   722 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator;
       
   723 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   724 
       
   725 	// basic new message with subject, originator, VCard and Signature
       
   726 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   727 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   728 
       
   729 	// only body, subject, originator, VCard and Signature
       
   730 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   731 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   732 
       
   733 	// only attachment, subject, originator, VCard and Signature
       
   734 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   735 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   736 
       
   737 	// only body, attachment, subject, originator, VCard and Signature
       
   738 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator;
       
   739 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   740 
       
   741 	// basic new message with recipients, VCard and Signature
       
   742 	partList = KMsvMessagePartRecipient;
       
   743 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   744 
       
   745 	// only body, recipients, VCard and Signature
       
   746 	partList = KMsvMessagePartBody | KMsvMessagePartRecipient;
       
   747 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   748 
       
   749 	// only attachment, recipients, VCard and Signature
       
   750 	partList = KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   751 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   752 
       
   753 	// only body, attachment, recipients, VCard and Signature
       
   754 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartRecipient;
       
   755 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   756 
       
   757 	// basic new message with subject, recipients, VCard and Signature
       
   758 	partList = KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   759 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   760 
       
   761 	// only body, subject, recipients, VCard and Signature
       
   762 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   763 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   764 
       
   765 	// only attachment, subject, recipients, VCard and Signature
       
   766 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   767 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   768 
       
   769 	// only body, attachment, subject, recipients, VCard and Signature
       
   770 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartRecipient;
       
   771 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   772 
       
   773 	// basic new message with originator, recipients, VCard and Signature
       
   774 	partList = KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   775 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   776 
       
   777 	// only body, originator, recipients, VCard and Signature
       
   778 	partList = KMsvMessagePartBody | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   779 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   780 
       
   781 	// only attachment, originator, recipients, VCard and Signature
       
   782 	partList = KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   783 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   784 
       
   785 	// only body, attachment, originator, recipients, VCard and Signature
       
   786 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   787 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   788 
       
   789 	// basic new message with subject, originator, recipients, VCard and Signature
       
   790 	partList = KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   791 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   792 
       
   793 	// only body, subject, originator, recipients, VCard and Signature
       
   794 	partList = KMsvMessagePartBody | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   795 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   796 
       
   797 	// only attachment, subject, originator, recipients, VCard and Signature
       
   798 	partList = KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   799 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   800 
       
   801 	// only body, attachment, subject, originator, recipients, VCard and Signature
       
   802 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator | KMsvMessagePartRecipient;
       
   803 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   804 	}
       
   805 
       
   806 LOCAL_C void DoPlaintextCreateForwardIncludeToCcTestsL(TMsvId aMessageId)
       
   807 	{
       
   808 	TMsvPartList partList = 0; 
       
   809 	TMsvEmailTypeList emailTypeList = 0;
       
   810 
       
   811 	//
       
   812 	// Plaintext messages
       
   813 	//
       
   814 	
       
   815 	// set #1 - no To/Cc header information included
       
   816 	SetIncludeToCcL(0, smtpService);
       
   817 	testUtils->WriteComment(_L("\tPlaintext Create Forward Message IncludeToCc:0 Tests"));
       
   818 
       
   819 	// Body only, Forward to all
       
   820 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   821 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   822 
       
   823 	// attachments only, Forward to all
       
   824 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   825 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   826 
       
   827 	// Body and attachments, Forward to all
       
   828 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   829 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   830 
       
   831 
       
   832 	// set #2 - all To/Cc header information included
       
   833 	SetIncludeToCcL(10, smtpService);
       
   834 	testUtils->WriteComment(_L("\tPlaintext Create Forward Message IncludeToCc:10 Tests"));
       
   835 
       
   836 	// Body only, Forward to all
       
   837 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   838 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   839 
       
   840 	// attachments only, Forward to all
       
   841 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   842 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   843 
       
   844 	// Body and attachments, Forward to all
       
   845 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   846 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   847 
       
   848 	
       
   849 	// set #3 - truncated To/Cc header information included
       
   850 	SetIncludeToCcL(3, smtpService);
       
   851 	testUtils->WriteComment(_L("\tPlaintext Create Forward Message IncludeToCc:3 Tests"));
       
   852 
       
   853 	// Body only, Forward to all
       
   854 	partList = KMsvMessagePartBody | KMsvMessagePartDescription;
       
   855 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   856 
       
   857 	// attachments only, Forward to all
       
   858 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   859 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   860 
       
   861 	// Body and attachments, Forward to all
       
   862 	partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription;
       
   863 	CreateForwardL(aMessageId, partList, emailTypeList, testNo++);
       
   864 	
       
   865 	// Reset IncludeToCc setting.
       
   866 	SetIncludeToCcL(0, smtpService);
       
   867 	}
       
   868 
       
   869 
       
   870 LOCAL_C TBool CompareLogsL()
       
   871 	{
       
   872 	TBool errorOccured = EFalse;
       
   873 
       
   874 	CDesCArray* correctFile = new (ELeave) CDesCArrayFlat(1);
       
   875 	CPtrCArray* resultFile = new (ELeave) CPtrCArray(1);
       
   876 
       
   877 	TParse parsedFileName;
       
   878 	TParse parsedResultFileName;
       
   879 	TFileName name;
       
   880 	name.Append(KOkFileNameEntryStructure);
       
   881 	testUtils->ResolveFile(KComponent, name, parsedFileName);
       
   882 	correctFile->AppendL(parsedFileName.FullName());
       
   883 	name.Zero();
       
   884 	name.Copy(KFileNameEntryStructure);
       
   885 	testUtils->ResolveLogFile(name, parsedResultFileName);
       
   886 	resultFile->AppendL(parsedResultFileName.FullName());
       
   887 
       
   888 	RFileReadStream file1;
       
   889 	RFileReadStream file2;
       
   890 	HBufC8* line1Buffer = HBufC8::NewLC(1024);
       
   891 	TPtr8 line1 = line1Buffer->Des();
       
   892 	TBuf8<1> aChar1;
       
   893 
       
   894 	HBufC8* line2Buffer = HBufC8::NewLC(1024);
       
   895 	TPtr8 line2 = line2Buffer->Des();
       
   896 	TBuf8<1> aChar2;
       
   897 
       
   898 	for(TInt i=0; i<correctFile->MdcaCount(); i++)
       
   899 		{
       
   900 		TFileName file1Name = correctFile->MdcaPoint(i);
       
   901 
       
   902 		TFileName file2Name = resultFile->MdcaPoint(i);
       
   903 
       
   904 		TInt error1=KErrNone;
       
   905 		TInt error2=KErrNone;
       
   906 		
       
   907 		test.Printf(_L("\n%s"), file2Name.PtrZ());
       
   908 
       
   909 		error1=file1.Open(testUtils->FileSession(), file1Name, EFileShareAny);
       
   910 		if(error1!=KErrNone)
       
   911 			{
       
   912 			errorOccured = ETrue;
       
   913 			}
       
   914 		else
       
   915 			{
       
   916 			error2=file2.Open(testUtils->FileSession(), file2Name, EFileShareAny);
       
   917 			if(error2!=KErrNone)
       
   918 				{
       
   919 				errorOccured = ETrue;
       
   920 				}
       
   921 			}
       
   922 		
       
   923 		if((error1==KErrNone)&&(error2==KErrNone))
       
   924 			{
       
   925 			// read the file into the conversion object
       
   926 			TBool finished = EFalse;
       
   927 	
       
   928 			do	{
       
   929 				line1.FillZ();
       
   930 				line1.SetLength(0);
       
   931 				// compile the lines one char at a time
       
   932 				do	{
       
   933 					TRAPD( error, file1.ReadL(aChar1, 1) ); 
       
   934 					if (error!=KErrEof)
       
   935 						line1.Append(aChar1);
       
   936 					else
       
   937 						{
       
   938 						finished = ETrue;
       
   939 						break;
       
   940 						}
       
   941 					// stop at the end of line or no more data
       
   942 					}
       
   943 				while((aChar1[0]!=0x0A)&&(line1.Length()<1024));
       
   944 
       
   945 				line2.FillZ();
       
   946 				line2.SetLength(0);
       
   947 				do	{
       
   948 					TRAPD( error, file2.ReadL(aChar2, 1) ); 
       
   949 					if (error!=KErrEof)
       
   950 						line2.Append(aChar2);
       
   951 					else
       
   952 						{
       
   953 						finished = ETrue;
       
   954 						break;
       
   955 						}
       
   956 					// stop at the end of line or no more data
       
   957 					}
       
   958 				while((aChar2[0]!=0x0A)&&(line2.Length()<1024));
       
   959 
       
   960 				// get rid of white space
       
   961    				line1.TrimRight();
       
   962    				line2.TrimRight();
       
   963    
       
   964    				if(line1.Compare(line2) != 0)
       
   965    					{
       
   966    					// error so no point in continuing to compare!!
       
   967    					errorOccured = ETrue;
       
   968    					file1.Close();
       
   969    					file2.Close();
       
   970    					delete correctFile;
       
   971    					delete resultFile;
       
   972    					CleanupStack::PopAndDestroy(2);  //line 1 , line 2
       
   973    					return ETrue;
       
   974    					}
       
   975 
       
   976 				}
       
   977 			while(!finished);
       
   978 			}		
       
   979 
       
   980 		file1.Close();
       
   981 		file2.Close();
       
   982 		}
       
   983 
       
   984 	delete correctFile;
       
   985 	delete resultFile;
       
   986 	CleanupStack::PopAndDestroy(2);  //line 1 , line 2
       
   987 	
       
   988 	return errorOccured;
       
   989 	}
       
   990 
       
   991 LOCAL_C void doMainL()
       
   992 	{
       
   993 	InitL();
       
   994 	if (testFailed)
       
   995 		{
       
   996 		Closedown();
       
   997 		return;
       
   998 		}
       
   999 	testUtils->GoClientSideL();
       
  1000 	smtpService = testUtils->CreateSmtpServiceL();
       
  1001 	pop3Service = testUtils->CreatePopServiceL();
       
  1002 	testUtils->GoServerSideL();
       
  1003 
       
  1004 	testUtils->CreateMessageFilesL(pop3Service, KMsvGlobalInBoxIndexEntryId, _L("c:\\mailtest\\IMCM\\"));
       
  1005 
       
  1006 	test.Console()->SetPos(0, 6);
       
  1007 	test.Printf(_L("Performing Tests:\n"));
       
  1008 	
       
  1009 	testUtils->GoClientSideL();
       
  1010 
       
  1011 	SetDefaultServiceL(smtpService);
       
  1012 
       
  1013 	// get a list of all email messages in the Inbox
       
  1014 	testUtils->iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
       
  1015 	delete messageSelection;
       
  1016 	messageSelection = testUtils->iMsvEntry->ChildrenWithTypeL(KUidMsvMessageEntry);
       
  1017 
       
  1018 	TParse parsedFileName;
       
  1019 	TFileName name(KTestMessageDir);
       
  1020 	testUtils->ResolveLogFile(name, parsedFileName);
       
  1021 
       
  1022 //
       
  1023 //	Create Plaintext Forward tests
       
  1024 //
       
  1025 	SetKnownDateAndTime();
       
  1026 
       
  1027 	test.Console()->SetPos(3, 7);
       
  1028 	test.Printf(_L("Create Forward Tests1:"));
       
  1029 	testUtils->WriteComment(_L("Test 1 - Create Plaintext Forward Tests"));
       
  1030 	// Forward to normal plaintext message with no attachments
       
  1031 	testUtils->WriteComment(_L("Create Forward to Plaintext message with no attachments Tests"));
       
  1032 	TRAPD(ret,DoPlaintextCreateForwardTestsL(messageSelection->At(5)));
       
  1033 	if (ret)
       
  1034 		{
       
  1035 		testUtils->TestFinish(testNo,ret);
       
  1036 		testUtils->TestHarnessFailed(ret);
       
  1037 		delete messageSelection;
       
  1038 		Closedown();
       
  1039 		return;
       
  1040 		}
       
  1041 
       
  1042 	SetKnownDateAndTime();
       
  1043 
       
  1044 	test.Console()->SetPos(3, 8);
       
  1045 	test.Printf(_L("Create Forward Tests 2:  "));
       
  1046 	//Create Forwarded message to plaintext message with attachment
       
  1047 	testUtils->WriteComment(_L("Test 2 -Create Forward to Plaintext message with attachment Tests"));
       
  1048 	TRAP(ret,DoPlaintextCreateForwardTestsL(messageSelection->At(1)));
       
  1049 	if (ret)
       
  1050 		{
       
  1051 		testUtils->TestFinish(testNo,ret);
       
  1052 		testUtils->TestHarnessFailed(ret);
       
  1053 		delete messageSelection;
       
  1054 		Closedown();
       
  1055 		return;
       
  1056 		}
       
  1057 
       
  1058 	SetKnownDateAndTime();
       
  1059 
       
  1060 	//Create Forwarded html message with attachment and no text alternative to the HTML
       
  1061 	test.Console()->SetPos(3, 9);
       
  1062 	test.Printf(_L("Create Forward Tests 3:  "));
       
  1063 	testUtils->WriteComment(_L("Test 3 - Create Forward to HTML message with attachment and no text alt. Tests"));
       
  1064 	TRAP(ret,DoPlaintextCreateForwardTestsL(messageSelection->At(3)));
       
  1065 	if (ret)
       
  1066 		{
       
  1067 		testUtils->TestFinish(testNo,ret);
       
  1068 		testUtils->TestHarnessFailed(ret);
       
  1069 		delete messageSelection;
       
  1070 		Closedown();
       
  1071 		return;
       
  1072 		}
       
  1073 
       
  1074 	SetKnownDateAndTime();
       
  1075 
       
  1076 	test.Console()->SetPos(3, 10);
       
  1077 	test.Printf(_L("Create Forward Tests 4:  "));
       
  1078 	//Create Forward to to plaintext message, include To/Cc info in body header.
       
  1079 	testUtils->WriteComment(_L("Test 4 - Create Forward to Plaintext message including to/cc info Tests"));
       
  1080 	TRAP(ret,DoPlaintextCreateForwardIncludeToCcTestsL(messageSelection->At(6)));
       
  1081 	if (ret!=KErrNone)
       
  1082 		{
       
  1083 		testUtils->TestFinish(testNo,ret);
       
  1084 		testUtils->TestHarnessFailed(ret);
       
  1085 		delete messageSelection;
       
  1086 		Closedown();
       
  1087 		return;
       
  1088 		}
       
  1089 	
       
  1090 	SetKnownDateAndTime();
       
  1091 
       
  1092 	test.Console()->SetPos(3, 11);
       
  1093 	test.Printf(_L("Create Forward Tests 5:  "));
       
  1094 	//Create Forward to to plaintext message, include To/Cc info in body header.
       
  1095 	testUtils->WriteComment(_L("Test 5 - Create Forward to Plaintext message including to only info Tests"));
       
  1096 	TRAP(ret,DoPlaintextCreateForwardIncludeToCcTestsL(messageSelection->At(7)));
       
  1097 	if (ret!=KErrNone)
       
  1098 		{
       
  1099 		testUtils->TestFinish(testNo,ret);
       
  1100 		testUtils->TestHarnessFailed(ret);
       
  1101 		delete messageSelection;
       
  1102 		Closedown();
       
  1103 		return;
       
  1104 		}
       
  1105 	
       
  1106 	SetKnownDateAndTime();
       
  1107 
       
  1108 	test.Console()->SetPos(3, 12);
       
  1109 	test.Printf(_L("Create Forward Tests 6:  "));
       
  1110 	//Create Forward to to plaintext message, include To/Cc info in body header.
       
  1111 	testUtils->WriteComment(_L("Test 6 - Create Forward to Plaintext message including cc only info Tests"));
       
  1112 	TRAP(ret,DoPlaintextCreateForwardIncludeToCcTestsL(messageSelection->At(8)));
       
  1113 	if (ret!=KErrNone)
       
  1114 		{
       
  1115 		testUtils->TestFinish(testNo,ret);
       
  1116 		testUtils->TestHarnessFailed(ret);
       
  1117 		delete messageSelection;
       
  1118 		Closedown();
       
  1119 		return;
       
  1120 		}
       
  1121 
       
  1122 	RestoreDateAndTime();
       
  1123 
       
  1124 	testUtils->FindChildrenL(KMsvGlobalOutBoxIndexEntryId, parsedFileName.FullName(), ETrue, EFalse); // writes message info (from Outbox) into files
       
  1125 
       
  1126 	testUtils->TestFinish(testNo-1);
       
  1127  	testUtils->TestHarnessCompleted();
       
  1128 
       
  1129 	delete messageSelection;
       
  1130 	Closedown();
       
  1131 	}
       
  1132 
       
  1133 GLDEF_C TInt E32Main()
       
  1134 	{	
       
  1135 	__UHEAP_MARK;
       
  1136 	test.Start(_L("T_IMCM02c Test CImEmailOperation class\n"));
       
  1137 	theCleanup=CTrapCleanup::New();
       
  1138 	TRAPD(ret,doMainL());
       
  1139 	test(ret==KErrNone);
       
  1140 	RestoreDateAndTime();
       
  1141 	delete theCleanup;	
       
  1142 	test.End();
       
  1143 	test.Close();
       
  1144 	__UHEAP_MARKEND;
       
  1145 	User::Heap().Check();
       
  1146 	return(KErrNone);
       
  1147 	}