1.1 --- a/epoc32/include/smtpset.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,325 +0,0 @@
1.4 -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#if !defined (__SMTPSET_H__)
1.20 -#define __SMTPSET_H__
1.21 -
1.22 -
1.23 -#include <msvuids.h>
1.24 -#include <miutset.h>
1.25 -
1.26 -/** Default SMTP server port number.*/
1.27 -const TUint32 KSMTPDefaultPortNumber = 25;
1.28 -
1.29 -/** Default/maximum addresses to include in body header of reply/forward messages */
1.30 -const TInt KSmtpToCcIncludeLimitDefault = 0;
1.31 -const TInt KSmtpToCcIncludeLimitMax = KMaxTInt;
1.32 -
1.33 -
1.34 -/**
1.35 -Defines options that allows the user to automatically email themselves a copy
1.36 -of all emails that are sent from the phone.
1.37 -
1.38 -@see CImSmtpSettings::SendCopyToSelf()
1.39 -
1.40 -@publishedAll
1.41 -@released
1.42 -*/
1.43 -enum TImSMTPSendCopyToSelf
1.44 - {
1.45 - /** Do not send a copy. */
1.46 - ESendNoCopy,
1.47 - /** Send a copy, with the user's address added to the To address list. */
1.48 - ESendCopyAsToRecipient,
1.49 - /** Send a copy, with the user's address added to the Cc: address list. */
1.50 - ESendCopyAsCcRecipient,
1.51 - /** Send a copy, with the user's address added to the Bcc: address list. */
1.52 - ESendCopyAsBccRecipient
1.53 - };
1.54 -/**
1.55 -Defines sending options for new email messages.
1.56 -
1.57 -The option has no direct effect on the SMTP MTM, although messages in the
1.58 -outbox which are marked as ESendMessageOnNextConnection or ESendMessageImmediately
1.59 -will be appended automatically to the list of messages supplied by the client
1.60 -when either CBaseServerMtm::CopyFromLocal() or CBaseServerMtm::MoveFromLocal()
1.61 -are called.
1.62 -
1.63 -@publishedAll
1.64 -@released
1.65 -*/
1.66 -enum TImSMTPSendMessageOption
1.67 - {
1.68 - /** Send message immediately. */
1.69 - ESendMessageImmediately,
1.70 - /** Send message when the next connection occurs. */
1.71 - ESendMessageOnNextConnection,
1.72 - /** Send message only when the user requests this. */
1.73 - ESendMessageOnRequest
1.74 - };
1.75 -
1.76 -/**
1.77 -Defines status values for the SMTP MTM.
1.78 -
1.79 -@publishedAll
1.80 -@released
1.81 -*/
1.82 -enum TMsgImOutboxSendState
1.83 - {
1.84 - /** Idle. */
1.85 - EMsgOutboxProgressWaiting,
1.86 - /** Connecting to server. */
1.87 - EMsgOutboxProgressConnecting,
1.88 - /** Sending messages. */
1.89 - EMsgOutboxProgressSending,
1.90 - /** Sending complete. */
1.91 - EMsgOutboxProgressDone
1.92 - };
1.93 -
1.94 -/** Sending state for SMTP.
1.95 -
1.96 -@publishedAll
1.97 -@released
1.98 -*/
1.99 -enum TSmtpSessionState
1.100 - {
1.101 - /** Dialling, looking up DNS, or connecting to SMTP server. */
1.102 - EConnectingToSmtp,
1.103 - /** Waiting for the SMTP server to send welcome message. */
1.104 - EWaitingForReply,
1.105 - /** Sending HELO/EHLO command to the server. */
1.106 - EAuthorisingSmtp,
1.107 - /** Sending the STARTTLS command, if a secure connection was requested. */
1.108 - ESendingStarttls,
1.109 - /** Exchanging certificates with server, if a secure connection was requested. */
1.110 - ESettingSecurity,
1.111 - /** Sending a message to the server. */
1.112 - ESendingImail,
1.113 - /** Logging result. */
1.114 - ELogDataEvent,
1.115 - /** Disconnecting from the SMTP server. */
1.116 - EClosingSmtp,
1.117 - /** AUTH in progress. */
1.118 - EAuthInProgress,
1.119 - /** RSET in progress. */
1.120 - EResetSmtp
1.121 - };
1.122 -
1.123 -class TImImailFileProgress
1.124 -/**
1.125 -Status information about the SMTP message which is being sent.
1.126 -
1.127 -@publishedAll
1.128 -@released
1.129 -*/
1.130 - {
1.131 -public:
1.132 - /**
1.133 - Amount of data from the message already sent to the server in bytes.
1.134 -
1.135 - Note that the SMTP MTM encodes the text and binary data inside an email message
1.136 - while it is sending the data. As a result, iBytesToSend is likely to increase
1.137 - (by as much as one third) while a message is being sent. The size increase
1.138 - represents all additional bytes which have been added to the RFC 822 message
1.139 - to encode the data.
1.140 - */
1.141 - TInt iBytesSent;
1.142 - /** Amount of data from the message still to be sent to the server in bytes. */
1.143 - TInt iBytesToSend;
1.144 - /** Sending state. */
1.145 - TSmtpSessionState iSessionState;
1.146 - };
1.147 -
1.148 -class TImSmtpProgress
1.149 -/**
1.150 -Progress information for SMTP operations on the Internet Mail MTM.
1.151 -
1.152 -The information is obtained through calling CMsvOperation::Progress()
1.153 -on the operation. It is packaged into an 8-bit descriptor.
1.154 -
1.155 -Messaging clients use the getter functions to get various types
1.156 -of information about an operation's progress. The setter functions
1.157 -are for use by the MTM.
1.158 -
1.159 -@publishedAll
1.160 -@released
1.161 -*/
1.162 - {
1.163 -
1.164 -public:
1.165 - IMPORT_C TMsgImOutboxSendState Status() const; // Progress: current progress status of mail session
1.166 - IMPORT_C TInt MsgNo() const; // Progress: No. of message currently being sent; zero=1st message
1.167 - IMPORT_C TInt Error() const; // Summary: completion code from end of last session
1.168 - IMPORT_C TInt Sent() const; // Summary: No. messages sent successfully
1.169 - IMPORT_C TInt NotSent() const; // Summary: No. messages I didn't attempt to send
1.170 - IMPORT_C TInt FailedToSend() const; // Summary: No. messages attempted to send but failed
1.171 - IMPORT_C TInt SendTotal() const; // Sent() + NotSent() + FailedToSend() = SendTotal()
1.172 - IMPORT_C void SetError(TInt anError);
1.173 - IMPORT_C void SetStatus(TMsgImOutboxSendState aStatus);
1.174 - IMPORT_C void SetMsgNo(TInt aMsgNo);
1.175 - IMPORT_C void InitialiseTotal(const TInt& aTotal);
1.176 - IMPORT_C void UpdateSent();
1.177 - IMPORT_C void UpdateFailedToSend();
1.178 - IMPORT_C void DecrementSendTotal();
1.179 - IMPORT_C TMsvId ServiceId() const;
1.180 - IMPORT_C void SetServiceId(TMsvId aServiceId);
1.181 - IMPORT_C TInt ConnectionState() const;
1.182 - IMPORT_C TInt ConnectionIAP() const;
1.183 - IMPORT_C void SetConnectionIAP(TInt aConnectionIAP);
1.184 -
1.185 -public:
1.186 - /** Status information about the message that is currently being sent (if
1.187 - sending is in progress). */
1.188 - TImImailFileProgress iSendFileProgress;
1.189 -
1.190 -private:
1.191 - TMsgImOutboxSendState iStatus;
1.192 - TInt iError;
1.193 - TInt iMsgNo;
1.194 - TInt iSent;
1.195 - TInt iNotSent;
1.196 - TInt iFailedToSend;
1.197 - TInt iSendTotal;
1.198 - TMsvId iServiceId;
1.199 - };
1.200 -
1.201 -class CImSmtpSettings : public CImBaseEmailSettings
1.202 -/**
1.203 -Run-time configuration settings for an SMTP account.
1.204 -
1.205 -Messaging clients should use an instance of this class to specify
1.206 -and retrieve configuration settings that are used by the SMTP service when
1.207 -executing email operations.
1.208 -
1.209 -Service settings such as the email body encoding, reply address, character set,
1.210 -and whether to attach a signature or vCard can be specified using this class.
1.211 -Storing and restoring from the message store is also supported.
1.212 -
1.213 -To use this class to change a setting:
1.214 -
1.215 -1) Set the current context to the SMTP service entry using CMsvStore.
1.216 -
1.217 -2) Create an instance of CImSmtpSettings and put it on the cleanup stack.
1.218 -
1.219 -3) Retrieve the existing settings by calling CImSmtpSettings::RestoreL().
1.220 -
1.221 -4) Specify whether to add a vCard to outbound email by calling CImSmtpSettings::SetAddVCardToEmail().
1.222 -
1.223 -5) Save the new settings by calling CImSmtpSettings::StoreL().
1.224 -
1.225 -6) Pop and destroy the CImSmtpSettings instance.
1.226 -
1.227 -@see CMsvStore
1.228 -
1.229 -@publishedAll
1.230 -@released
1.231 -*/
1.232 - {
1.233 -public:
1.234 - IMPORT_C CImSmtpSettings();
1.235 - IMPORT_C virtual ~CImSmtpSettings();
1.236 - IMPORT_C void Reset();
1.237 - IMPORT_C const TPtrC EmailAlias() const;
1.238 - IMPORT_C void SetEmailAliasL(const TDesC& aEmailAlias);
1.239 - IMPORT_C const TPtrC EmailAddress() const;
1.240 - IMPORT_C void SetEmailAddressL(const TDesC& aEmailAddress);
1.241 - IMPORT_C const TPtrC ReplyToAddress() const;
1.242 - IMPORT_C void SetReplyToAddressL(const TDesC& aReplyToAddress);
1.243 - IMPORT_C const TPtrC ReceiptAddress() const;
1.244 - IMPORT_C void SetReceiptAddressL(const TDesC& aReceiptAddress);
1.245 - IMPORT_C TMsgOutboxBodyEncoding BodyEncoding() const;
1.246 - IMPORT_C void SetBodyEncoding(TMsgOutboxBodyEncoding aBodyEncoding);
1.247 - IMPORT_C const TUid DefaultMsgCharSet() const;
1.248 - IMPORT_C void SetDefaultMsgCharSet(TUid aDefaultMsgCharSet);
1.249 - IMPORT_C TBool AddVCardToEmail() const;
1.250 - IMPORT_C void SetAddVCardToEmail(TBool aFlag);
1.251 - IMPORT_C TBool AddSignatureToEmail() const;
1.252 - IMPORT_C void SetAddSignatureToEmail(TBool aFlag);
1.253 - IMPORT_C TBool RequestReceipts() const;
1.254 - IMPORT_C void SetRequestReceipts(TBool aFlag);
1.255 - IMPORT_C TImSMTPSendCopyToSelf SendCopyToSelf() const;
1.256 - IMPORT_C void SetSendCopyToSelf(TImSMTPSendCopyToSelf aSendCopyToSelf);
1.257 - IMPORT_C TImSMTPSendMessageOption SendMessageOption() const;
1.258 - IMPORT_C void SetSendMessageOption(TImSMTPSendMessageOption aSendMessageOption);
1.259 - IMPORT_C CImSmtpSettings& CopyL(const CImSmtpSettings& aCImSmtpSettings);
1.260 - IMPORT_C TBool operator==(const CImSmtpSettings& aCImSmtpSettings) const;
1.261 - IMPORT_C const TPtrC8 LoginName() const;
1.262 - IMPORT_C void SetLoginNameL(const TDesC8&);
1.263 - IMPORT_C const TPtrC8 Password() const;
1.264 - IMPORT_C void SetPasswordL(const TDesC8&);
1.265 - IMPORT_C TBool SMTPAuth() const;
1.266 - IMPORT_C void SetSMTPAuth(TBool aFlag);
1.267 - IMPORT_C TBool InboxLoginDetails() const;
1.268 - IMPORT_C void SetInboxLoginDetails(TBool aFlag);
1.269 - IMPORT_C TInt ToCcIncludeLimit() const;
1.270 - IMPORT_C void SetToCcIncludeLimitL(TInt aLimit);
1.271 - IMPORT_C void SetTlsSslDomainL(const TDesC8& aDomainName);
1.272 - IMPORT_C TPtrC8 TlsSslDomain() const;
1.273 -
1.274 -private:
1.275 - class TImSmtpSettingsExtension
1.276 - {
1.277 - public:
1.278 - inline TImSmtpSettingsExtension();
1.279 - public:
1.280 - HBufC* iReceiptAddress;
1.281 - HBufC8* iLoginName;
1.282 - HBufC8* iPassword;
1.283 - HBufC8* iTlsSslDomain;
1.284 - TInt iToCcIncludeLimit;
1.285 - };
1.286 -
1.287 - inline TImSmtpSettingsExtension* Extension() const;
1.288 - inline void CheckExtensionExistsL();
1.289 -
1.290 -private:
1.291 - enum TImSMTPEmailSettings
1.292 - {
1.293 - KSmtpSettingsClearFlag = 0x00000000,
1.294 - KSmtpBaseEmailSettingsLastUsedFlag = CImBaseEmailSettings::EBaseEmailSettingsLastUsedFlag, //0x00000002
1.295 - KSmtpAddVCardToEmailFlag = KSmtpBaseEmailSettingsLastUsedFlag << 1, //0x00000004
1.296 - KSmtpAddSignatureToEmailFlag = KSmtpAddVCardToEmailFlag << 1, //0x00000008
1.297 - KSmtpRequestReceipts = KSmtpAddSignatureToEmailFlag << 1, //0x00000010
1.298 - KSmtpSmtpAuthFlag = KSmtpRequestReceipts << 1, //0x00000020
1.299 - KSmtpInboxLoginDetails = KSmtpSmtpAuthFlag << 1, //0x00000040
1.300 - KSmtpEmailSettingsLastUsedFlag = KSmtpInboxLoginDetails //0x00000040
1.301 - };
1.302 -
1.303 - HBufC* iEmailAlias;
1.304 - HBufC* iEmailAddress;
1.305 - HBufC* iReplyToAddress;
1.306 - TImSmtpSettingsExtension* iExtension; // renamed iReceiptAddress
1.307 - TMsgOutboxBodyEncoding iBodyEncoding;
1.308 - TUid iDefaultMsgCharSet;
1.309 - TImSMTPSendCopyToSelf iSendCopyToSelf;
1.310 - TImSMTPSendMessageOption iSendMessageOption;
1.311 - };
1.312 -
1.313 -inline CImSmtpSettings::TImSmtpSettingsExtension* CImSmtpSettings::Extension() const
1.314 - {
1.315 - return iExtension;
1.316 - }
1.317 -
1.318 -inline void CImSmtpSettings::CheckExtensionExistsL()
1.319 - {
1.320 - if (!iExtension)
1.321 - iExtension=new (ELeave) CImSmtpSettings::TImSmtpSettingsExtension;
1.322 - }
1.323 -
1.324 -inline CImSmtpSettings::TImSmtpSettingsExtension::TImSmtpSettingsExtension() : iReceiptAddress(NULL),iLoginName(NULL),iPassword(NULL),iTlsSslDomain(NULL),iToCcIncludeLimit(KSmtpToCcIncludeLimitDefault)
1.325 - {
1.326 - }
1.327 -
1.328 -#endif // #define __SMTPSET_H__