本文整理汇总了C++中CEmailAccounts::GetSmtpAccountL方法的典型用法代码示例。如果您正苦于以下问题:C++ CEmailAccounts::GetSmtpAccountL方法的具体用法?C++ CEmailAccounts::GetSmtpAccountL怎么用?C++ CEmailAccounts::GetSmtpAccountL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEmailAccounts
的用法示例。
在下文中一共展示了CEmailAccounts::GetSmtpAccountL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResetSettingsL
LOCAL_C void ResetSettingsL(TBool aSecureSocket)
{
_LIT(KSmtpServer, "smtp.demon.co.uk");
_LIT(KSmtpEmailAlias, "SMTP STARTTLS");
_LIT(KSmtpEmailAddress, "<[email protected]>");
// Overwrite the setings with test code one. Don't want the default settings.
CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
CleanupStack::PushL(settings);
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccountId;
accounts->GetSmtpAccountL(smtpService,smtpAccountId);
accounts->LoadSmtpSettingsL(smtpAccountId, *settings);
settings->SetServerAddressL(KSmtpServer);
settings->SetEmailAliasL(KSmtpEmailAlias);
settings->SetEmailAddressL(KSmtpEmailAddress);
settings->SetReplyToAddressL(KSmtpEmailAddress);
settings->SetBodyEncoding(EMsgOutboxMIME);
settings->SetReceiptAddressL(KSmtpEmailAddress);
settings->SetSecureSockets(aSecureSocket);
settings->SetPort(25);
accounts->SaveSmtpSettingsL(smtpAccountId, *settings);
CleanupStack::PopAndDestroy(2, settings); //settings, store/accounts
}
示例2: OverwriteSmtpSettingsL
LOCAL_C void OverwriteSmtpSettingsL(TBool aRequestReceipt)
{
testUtils->iMsvEntry->SetEntryL(smtpService);
//overwrite the setings with test code one. Don't want the default settings.
CEmailAccounts* accounts = CEmailAccounts::NewLC();
CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
CleanupStack::PushL(settings);
settings->Reset();
_LIT(KSmtpServer, "msg6");
// globel address for msg6 is fe80::2c0:4fff:fe84:61f7
// link local address fe80::1111:1111:dead:beef
settings->SetServerAddressL(KSmtpServer);
settings->SetEmailAliasL(_L("SMTP_IPV6 Test"));
_LIT(KSmtpEmailAddress, "<[email protected]>");
settings->SetEmailAddressL(KSmtpEmailAddress);
settings->SetReplyToAddressL(KSmtpEmailAddress);
settings->SetBodyEncoding(EMsgOutboxMIME);
settings->SetReceiptAddressL(KSmtpEmailAddress);
settings->SetRequestReceipts(aRequestReceipt);
settings->SetPort(25);
TSmtpAccount smtpAccountId;
accounts->GetSmtpAccountL(smtpService, smtpAccountId);
accounts->SaveSmtpSettingsL(smtpAccountId, *settings);
CleanupStack::PopAndDestroy(2); //settings, store/account
CTestTimer* timer = CTestTimer::NewL();
timer->After(5000000);
CActiveScheduler::Start();
delete timer;
}
示例3: ChangeDefaultServiceL
/**
Sets the default SMTP service.
@param aService
The default service
*/
EXPORT_C void CSmtpClientMtm::ChangeDefaultServiceL(const TMsvId& aService)
{
CEmailAccounts* account = CEmailAccounts::NewLC();
TSmtpAccount id;
account->GetSmtpAccountL(aService, id);
account->SetDefaultSmtpAccountL(id);
CleanupStack::PopAndDestroy(account);
}
示例4: LoadSettingsL
void CMtfTestActionGetPopAccountSettings::LoadSettingsL(CEmailAccounts& aAccounts, const TPopAccount& aAccount, CImPop3Settings& aPopSettings, CImIAPPreferences& aPopIapSettings, CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings)
{
aAccounts.LoadPopSettingsL(aAccount, aPopSettings);
aAccounts.LoadPopIapSettingsL(aAccount, aPopIapSettings);
TSmtpAccount smtpAccount;
aAccounts.GetSmtpAccountL(aAccount.iSmtpService, smtpAccount);
aAccounts.LoadSmtpSettingsL(smtpAccount, aSmtpSettings);
aAccounts.LoadSmtpIapSettingsL(smtpAccount, aSmtpIapSettings);
}
示例5: LoadAccountSettingsL
/**
LoadAccountSettingsL()
This function loads the IMAP and SMTP settings object from the IMAP account given
@param aEmailAccount
An object of type CEmailAccounts
@param aAccount
An object of type TPopAccount
@param aPopSettings
An object of type CImPop3Settings
@param aPopIapSettings
An object of type CImIAPPreferences
@param aSmtpSettings
An object of type CImSmtpSettings
@param aSmtpIapSettings
An object of type CImIAPPreferences
@return : void
*/
void CT_MsgComparePopSettings::LoadAccountSettingsL(CEmailAccounts& aEmailAccount, const TPopAccount& aAccount, CImPop3Settings& aPopSettings,
CImIAPPreferences& aPopIapSettings,CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings)
{
aEmailAccount.LoadPopSettingsL(aAccount, aPopSettings);
aEmailAccount.LoadPopIapSettingsL(aAccount, aPopIapSettings);
TSmtpAccount smtpAccount;
aEmailAccount.GetSmtpAccountL(aAccount.iSmtpService, smtpAccount);
aEmailAccount.LoadSmtpSettingsL(smtpAccount, aSmtpSettings);
aEmailAccount.LoadSmtpIapSettingsL(smtpAccount, aSmtpIapSettings);
}
示例6: RestoreSettingsL
EXPORT_C void CSmtpClientMtm::RestoreSettingsL()
/** Loads into the object's cache the service settings from the Central Repository
for the current entry. */
{
__ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid==KUidMsvServiceEntryValue, gPanic(ESmtcMTMNotAServiceEntry));
CEmailAccounts* account = CEmailAccounts::NewLC();
TSmtpAccount id;
account->GetSmtpAccountL(iMsvEntry->Entry().Id(), id);
account->LoadSmtpSettingsL(id, *iImSmtpSettings);
CleanupStack::PopAndDestroy(account);
}
示例7: CreateNewSmtpSettingsL
LOCAL_C void CreateNewSmtpSettingsL()
{
testUtils->iMsvEntry->SetEntryL(smtpService);
TMsvId serviceId = smtpService;
//overwrite the settings with test code one. Don't want the default settings.
CImSmtpSettings* settings = new(ELeave) CImSmtpSettings();
CleanupStack::PushL(settings);
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccountId;
accounts->GetSmtpAccountL( serviceId, smtpAccountId);
accounts->LoadSmtpSettingsL(smtpAccountId, *settings);
TInt serverLength = testUtils->MachineName().Length();
HBufC* serverad = HBufC::NewL(serverLength + 7 ); // 7 is the length of KServerAddress
CleanupStack::PushL(serverad);
serverad->Des().Copy(testUtils->MachineName());
serverad->Des().Append(KServer);
settings->SetServerAddressL(*serverad);
HBufC* emailaddress = HBufC::NewL(serverLength + 8 + serverad->Des().Length() + 1 );
CleanupStack::PushL(emailaddress);
emailaddress->Des().Copy(testUtils->MachineName());
emailaddress->Des().Append(KAt);
emailaddress->Des().Append(*serverad);
settings->SetEmailAddressL(*emailaddress);
settings->SetReplyToAddressL(*emailaddress);
settings->SetReceiptAddressL(*emailaddress);
settings->SetEmailAliasL(_L("Test Account"));
settings->SetBodyEncoding(EMsgOutboxMIME);
settings->SetRequestReceipts(EFalse);
settings->SetPort(25);
TSmtpAccount smtpAccount;
accounts->GetSmtpAccountL(smtpService, smtpAccount);
accounts->SaveSmtpSettingsL(smtpAccount, *settings);
CleanupStack::PopAndDestroy(emailaddress);
CleanupStack::PopAndDestroy(serverad);
CleanupStack::PopAndDestroy(2,settings);
testUtils->WriteComment(_L("Created New SmtpSettings "));
}
示例8: CreateMessageL
EXPORT_C void CSmtpClientMtm::CreateMessageL(TMsvId aServiceId)
/** Creates a new message entry as a child of the current context.
@param aServiceId ID of the service to own the entry. */
{
// fix for DEF051564 - SMTP client MTM CreateMessageL not creating message in correct state
TMsvEmailTypeList emailTypeList = KMsvEmailTypeListInvisibleMessage | KMsvEmailTypeListMessageInPreparation;
CEmailAccounts* account = CEmailAccounts::NewLC();
CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
CleanupStack::PushL(smtpSettings);
TSmtpAccount id;
account->GetSmtpAccountL(aServiceId, id);
account->LoadSmtpSettingsL(id, *smtpSettings);
switch (smtpSettings->BodyEncoding())
{
case EMsgOutboxMHTMLAsMIME:
case EMsgOutboxMHTMLAlternativeAsMIME:
emailTypeList |= KMsvEmailTypeListMHTMLMessage;
break;
case EMsgOutboxDefault:
case EMsgOutboxNoAlgorithm:
case EMsgOutboxMIME:
break;
}
CleanupStack::PopAndDestroy(2, account); // smtpSettings, account
// Now invoke the create new mail operation.
// Note that it is wrapped up to make the asynchronous call synchronous.
CMsvOperationActiveSchedulerWait* waiter=CMsvOperationActiveSchedulerWait::NewLC();
CImEmailOperation* createNewMailOp = CImEmailOperation::CreateNewL(waiter->iStatus, iMsvEntry->Session(), iMsvEntry->Entry().Id(), aServiceId, KMsvMessagePartBody|KMsvMessagePartAttachments, emailTypeList, KUidMsgTypeSMTP);
CleanupStack::PushL(createNewMailOp);
waiter->Start();
// The the entry is expected to be set to the new message.
TMsvId temp;
TPckgC<TMsvId> paramPack(temp);
const TDesC8& progBuf = createNewMailOp->ProgressL();
paramPack.Set(progBuf);
TMsvId messageId = paramPack();
iMsvEntry->SetEntryL(messageId);
CMsvStore* store = iMsvEntry->ReadStoreL();
CleanupStack::PushL(store);
iHeader->RestoreL(*store);
CleanupStack::PopAndDestroy(3, waiter); // waiter, createNewMailOp, store
}
示例9: SetDefaultServiceL
LOCAL_C void SetDefaultServiceL(TMsvId smtpService)
{
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccount;
accounts->GetSmtpAccountL(smtpService, smtpAccount);
accounts->SetDefaultSmtpAccountL(smtpAccount);
// is default service ??
TSmtpAccount defaultAccount;
accounts->DefaultSmtpAccountL(defaultAccount);
if (smtpService != defaultAccount.iSmtpService)
{
User::Leave(KErrNotFound);
}
CleanupStack::PopAndDestroy(accounts);
}
示例10: SetAddVCardToEmailL
LOCAL_C void SetAddVCardToEmailL(TBool addVCard, TMsvId serviceId)
{
CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
CleanupStack::PushL(smtpSettings);
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccount;
accounts->GetSmtpAccountL(serviceId, smtpAccount);
accounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings);
smtpSettings->SetAddVCardToEmail(addVCard);
accounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings);
CleanupStack::PopAndDestroy(2); // smtpSettings, accounts
}
示例11: doMainL
LOCAL_C void doMainL()
{
InitL();
test.Printf(_L("\nPerforming Tests\n"));
testUtils->iMsvEntry->SetEntryL(smtpService);
CTestTimer* timer = CTestTimer::NewL();
timer->After(5000000);
CActiveScheduler::Start();
delete timer;
// store service as default service
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccountId;
accounts->GetSmtpAccountL(smtpService, smtpAccountId);
accounts->SetDefaultSmtpAccountL(smtpAccountId);
CleanupStack::PopAndDestroy(accounts);
OverwriteSmtpSettingsL(EFalse);
CreateMessageL();
// Create a message that will request a receipt
OverwriteSmtpSettingsL(ETrue);
CreateMessageL();
testUtils->InstantiateSmtpClientMtmL();
timer = CTestTimer::NewL();
timer->After(5000000);
CActiveScheduler::Start();
delete timer;
testUtils->TestStart(testNo++);
TestSendingMessagesL();
testUtils->TestFinish(testNo-1);
testUtils->TestStart(testNo++);
TestCapabilityL();
testUtils->TestFinish(testNo-1);
testUtils->TestHarnessCompleted();
Closedown();
}
示例12: SetSignatureToEmailL
LOCAL_C void SetSignatureToEmailL(TBool addSignature, TMsvId serviceId)
{
CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings;
CleanupStack::PushL(smtpSettings);
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccount;
accounts->GetSmtpAccountL(serviceId, smtpAccount);
accounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings);
smtpSettings->SetAddSignatureToEmail(addSignature);
accounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings);
CleanupStack::PopAndDestroy(2); // smtpSettings, accounts
if (addSignature)
testUtils->WriteComment(_L("\tAdd VCard"));
}
示例13: ExecuteActionL
//.........这里部分代码省略.........
TBuf8<1> aChar; // To read one character from the file
TBool finished = FALSE;
recvConvert->ResetL();
// Parse each line from the
do {
line.FillZ();
line.SetLength(0);
// Read one line from email file
do {
file.Read(aChar, 1);
if(aChar.Length())
{
line.Append(aChar);
}
else
{
finished = TRUE;
}
} while(aChar.Length() && aChar[0] != 0x0A);
if(!line.Length())
{
break;
}
// Parse the line for the fields of the email and store them
recvConvert->ParseNextFieldL(line);
} while(!finished);
/****************************************************************************
Complete the message creation by setting all the required fields and
storing the email on to the message store.
The created email's ID is returned by MessageCompelteL function
****************************************************************************/
TMsvId paramMessageId;
paramMessageId = recvConvert->MessageCompleteL();
if(paramMessageId == 0)
{
User::Leave(KErrUnknown);
}
file.Close();
CleanupStack::PopAndDestroy(recvConvert);
if(overrideAddress)
{
#ifndef __MESSAGING_API_V2__
entry->SetEntryL(paramServiceId);
CMsvStore* store=entry->ReadStoreL();
CleanupStack::PushL(store);
#endif
CImSmtpSettings* settings= new(ELeave) CImSmtpSettings();
CleanupStack::PushL(settings);
#ifdef __MESSAGING_API_V2__
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccount;
accounts->GetSmtpAccountL(paramServiceId, smtpAccount);
accounts->LoadSmtpSettingsL(smtpAccount, *settings);
CleanupStack::PopAndDestroy();
#else
settings->RestoreL(*store);
CleanupStack::PopAndDestroy();
#endif
HBufC* emailAddress=settings->EmailAddress().AllocL();
CleanupStack::PopAndDestroy();
CleanupStack::PushL(emailAddress);
entry->SetEntryL(paramMessageId);
#ifdef __MESSAGING_API_V2__
CMsvStore* store=entry->EditStoreL();
#else
store=entry->EditStoreL();
#endif
CleanupStack::PushL(store);
CImHeader* header= CImHeader::NewLC();
header->RestoreL(*store);
header->ToRecipients().Reset();
header->ToRecipients().AppendL(*emailAddress);
header->StoreL(*store);
store->CommitL();
CleanupStack::PopAndDestroy(3,emailAddress);
}
CleanupStack::PopAndDestroy(entry);
TestCase().INFO_PRINTF2(_L("Created a email from file %S"),&fileName);
StoreParameterL<TMsvId>(TestCase(),paramMessageId,ActionParameters().Parameter(4));
fs.Close();
TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateSmtpMessageFromEmailFile);
TestCase().ActionCompletedL(*this);
}
示例14: SetupL
/**
Initialises the tests.
*/
void CTestCImPlainTextStore::SetupL()
{
iActiveWaiter = new (ELeave) CActiveWaiter();
testUtils = CEmailTestUtils::NewL(test);
testUtils->CreateAllTestDirectories();
testUtils->FileSession().SetSessionPath(_L("C:\\"));
testUtils->ClearEmailAccountsL();
testUtils->CleanMessageFolderL();
testUtils->GoServerSideL();
TBuf<KMaxFilePathLength>emailbodyfile(KEmail40kBodyFile);
RFs fsSession;
RFile infile;
User::LeaveIfError(fsSession.Connect());
User::LeaveIfError(infile.Open(fsSession, emailbodyfile, EFileRead));
TInt size = 0;
infile.Size(size);
//read the 8 bit data from the file
TInt chunkLength = size / 3;
HBufC8* tempBuf1 = HBufC8::NewL(chunkLength);
TPtr8 tempBufPtr1(tempBuf1->Des());
infile.Read(tempBufPtr1,chunkLength);
iFilebuf1 = HBufC16::NewL(chunkLength);
TPtr16 ptr1=iFilebuf1->Des();
ptr1.Copy(tempBufPtr1);
HBufC8* tempBuf2 = HBufC8::NewL(chunkLength);
TPtr8 tempBufPtr2(tempBuf2->Des());
infile.Read(tempBufPtr2,chunkLength);
iFilebuf2 = HBufC16::NewL(chunkLength);
TPtr16 ptr2=iFilebuf2->Des();
ptr2.Copy(tempBufPtr2);
HBufC8* tempBuf3 = HBufC8::NewL(chunkLength);
TPtr8 tempBufPtr3(tempBuf3->Des());
infile.Read(tempBufPtr3,chunkLength);
iFilebuf3 = HBufC16::NewL(chunkLength);
TPtr16 ptr3=iFilebuf3->Des();
ptr3.Copy(tempBufPtr3);
infile.Close();
testUtils->GoClientSideL();
testUtils->ClearEmailAccountsL();
smtpService = testUtils->CreateSmtpServiceL();
pop3Service = testUtils->CreatePopServiceL();
testUtils->GoServerSideL();
testUtils->FileSession().SetSessionPath(_L("c:\\"));
test.Printf(_L("\nPerforming Tests\n"));
testUtils->GoClientSideL();
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccount;
accounts->GetSmtpAccountL(smtpService, smtpAccount);
accounts->SetDefaultSmtpAccountL(smtpAccount);
CleanupStack::PopAndDestroy(accounts);
TParse parsedFileName;
TFileName name(KTestMessageDir);
testUtils->ResolveLogFile(name, parsedFileName);
// Get the default charset
CCnvCharacterSetConverter* characterConverter = CCnvCharacterSetConverter::NewL();
CleanupStack::PushL(characterConverter);
CImConvertCharconv* charConv = CImConvertCharconv::NewL(*characterConverter,fsSession );
CleanupStack::PushL(charConv);
iDefaultCharset = charConv->SystemDefaultCharset();
CleanupStack::PopAndDestroy(2);
fsSession.Close();
}
示例15: InitL
LOCAL_C void InitL()
{
// Load the serial comms device drivers. If this is not done,
// connecting via NT-RAS returns KErrNotFound (-1).
TInt driverErr;
driverErr=User::LoadPhysicalDevice(PDD_NAME);
if (driverErr!=KErrNone && driverErr!=KErrAlreadyExists)
User::Leave(driverErr);
driverErr=User::LoadLogicalDevice(LDD_NAME);
if (driverErr!=KErrNone && driverErr!=KErrAlreadyExists)
User::Leave(driverErr);
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
CActiveScheduler::Install(scheduler);
CleanupStack::PushL(scheduler);
testUtils = CEmailTestUtils::NewLC(test);
testUtils->CreateAllTestDirectories();
testUtils->FileSession().SetSessionPath(_L("C:\\"));
testUtils->CleanMessageFolderL();
testUtils->GoServerSideL();
testUtils->ClearEmailAccountsL();
test.Next(_L("Create Data Component FileStores"));
testUtils->CreateSmtpServerMtmRegL();
// Loading the DLLs
testUtils->CreateRegistryObjectAndControlL();
testUtils->InstallSmtpMtmGroupL();
testUtils->GoClientSideL();
// Create Services
smtpService = testUtils->CreateSmtpServiceL();
imap4Service = testUtils->CreateImapServiceL();
CEmailAccounts* accounts = CEmailAccounts::NewLC();
TSmtpAccount smtpAccount;
accounts->GetSmtpAccountL(smtpService, smtpAccount);
accounts->SetDefaultSmtpAccountL(smtpAccount);
testUtils->WriteComment(_L("Create Imap Services "));
// Delete any *.scr files in c:\logs\email directory.
testUtils->DeleteScriptFilesFromLogsDirL();
testUtils->iMsvEntry->SetEntryL(imap4Service);
//overwrite the settings with test code one. Don't want the default settings.
CImImap4Settings* settings = new(ELeave) CImImap4Settings();
CleanupStack::PushL(settings);
settings->Reset();
TInt serverLength = testUtils->MachineName().Length();
HBufC* serverad = HBufC::NewL(serverLength + 7 ); // 7 is the length of KServerAddress
CleanupStack::PushL(serverad);
serverad->Des().Copy(testUtils->MachineName());
serverad->Des().Append(KServer);
settings->SetServerAddressL(*serverad);
CleanupStack::PopAndDestroy(serverad);
settings->SetDeleteEmailsWhenDisconnecting(ETrue);
settings->SetAcknowledgeReceipts(ETrue);
settings->SetAutoSendOnConnect(ETrue);
settings->SetLoginNameL(testUtils->MachineName());
settings->SetPasswordL(testUtils->MachineName());
settings->SetPort(143);
settings->SetFolderPathL(KFolderPath);
accounts->GetImapAccountL(imap4Service, imapAccount);
accounts->SaveImapSettingsL(imapAccount, *settings);
CleanupStack::PopAndDestroy(2,accounts); //accounts,settings
test.Printf(_L("Instantiating IMAP4 Client MTM"));
testUtils->InstantiateImapClientMtmL();
}