1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
15 // SendSmtpMessage |
15 // SendSmtpMessage |
16 // [Parameters] |
16 // [Parameters] |
17 // ParentFolderName : Local folder name in which the message to be sent is |
17 // ParentFolderName : Local folder name in which the message to be sent is |
18 // present |
18 // present |
19 // Subject : Subject of the message to be sent |
19 // Subject : Subject of the message to be sent |
|
20 // SmtpAccountName : SMTP account name to be used for sending the message. If this is |
|
21 // not specified, message(s) would send using the default SMTP service. |
20 // Searches for the message with the specified subject and sends the message if the |
22 // Searches for the message with the specified subject and sends the message if the |
21 // message is found. If the local folder name is invalid or if the message is |
23 // message is found. If the local folder name is invalid or if the message is |
22 // not found in the given folder,the test step fails. |
24 // not found in the given folder,the test step fails. |
23 // [APIs Used] |
25 // [APIs Used] |
24 // CMsvEntry::SetEntryL |
26 // CMsvEntry::SetEntryL |
25 // CMsvEntry::CopyL |
27 // CMsvEntry::CopyL |
26 // |
28 // |
27 // |
29 // |
28 |
30 |
29 |
|
30 |
|
31 /** |
31 /** |
32 @file |
32 @file |
33 */ |
33 */ |
34 |
34 |
35 |
35 |
172 { |
173 { |
173 INFO_PRINTF2(_L("The Message Id is %d"),messageId ); |
174 INFO_PRINTF2(_L("The Message Id is %d"),messageId ); |
174 |
175 |
175 // Retrieve the default Smtp service Id |
176 // Retrieve the default Smtp service Id |
176 TMsvId smtpServiceId(0); |
177 TMsvId smtpServiceId(0); |
177 TRAPD(err, smtpServiceId = CT_MsgUtilsCentralRepository::GetDefaultSmtpServiceIdL()); |
178 TPtrC smtpAccountName; |
|
179 TInt err; |
|
180 if( !GetStringFromConfig(ConfigSection(), KSmtpAccountName, smtpAccountName )) |
|
181 { |
|
182 TRAP(err, smtpServiceId = CT_MsgUtilsCentralRepository::GetDefaultSmtpServiceIdL()); |
|
183 } |
|
184 else |
|
185 { |
|
186 TRAP(err, smtpServiceId = CT_MsgUtilsCentralRepository::GetSmtpServiceIdL((TDes&)smtpAccountName)); |
|
187 } |
|
188 |
178 if(err != KErrNone) |
189 if(err != KErrNone) |
179 { |
190 { |
180 ERR_PRINTF2(_L("Failure while getting the default SMTP Service Id. error = %d"),err); |
191 ERR_PRINTF2(_L("Failure while getting the SMTP Service Id. error = %d"),err); |
181 SetTestStepResult(EFail); |
192 SetTestStepResult(EFail); |
182 } |
193 } |
183 else |
194 else |
184 { |
195 { |
185 INFO_PRINTF2(_L("The Default Smtp Service Id is %d"),smtpServiceId ); |
196 INFO_PRINTF2(_L("The SMTP Service Id is %d"),smtpServiceId ); |
186 |
|
187 // Setting the current context to the parent of the mesage |
197 // Setting the current context to the parent of the mesage |
188 CMsvEntry* folderEntry = CMsvEntry::NewL(*iSharedDataSMTP.iSession, messageId , TMsvSelectionOrdering()); |
198 CMsvEntry* folderEntry = CMsvEntry::NewL(*iSharedDataSMTP.iSession, messageId , TMsvSelectionOrdering()); |
189 CleanupStack::PushL(folderEntry); |
199 CleanupStack::PushL(folderEntry); |
190 folderEntry->SetEntryL(messageId); |
200 folderEntry->SetEntryL(messageId); |
191 folderEntry->SetEntryL(folderEntry->Entry().Parent()); |
201 folderEntry->SetEntryL(folderEntry->Entry().Parent()); |
192 |
|
193 // Sends the message |
202 // Sends the message |
194 CT_MsgActive& active=Active(); |
203 CT_MsgActive& active=Active(); |
195 iOperation = folderEntry->CopyL(messageId, smtpServiceId, active.iStatus); |
204 iOperation = folderEntry->CopyL(messageId, smtpServiceId, active.iStatus); |
196 active.Activate(); |
205 active.Activate(); |
197 CActiveScheduler::Start(); |
206 CActiveScheduler::Start(); |