×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    Oulu, Finland
    Posts
    21

    Question Creating a Gmail account

    I'm having problems getting SMTP to work in a programmatically created Gmail (IMAP) account. I've tried the examples on http://developer.symbian.org/main/do..._overview.html and http://wiki.forum.nokia.com/index.ph...ng_application but neither seems to work. Gmail requires StartTLS on port 587 so I've used SetSecureSockets(ETrue) on the CImSmtpSettings object but I'm still getting "Unable to send message" when trying to send an email.

    Sending works perfectly with an account created by the email wizard on the phone, even though I use the same SMTP settings. What am I missing?

  2. #2
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,267

    Re: Creating a Gmail account

    Hi,

    The following code works fine for me, pay attention to the marked lines ("<==") and I think they are the key to enable gmail account.

    Code:
    // Create POP3/SMTP email account
    CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
        // Create POP3 account
    
        ... // assume that pop3Account is the account we created
    
        // Create SMTP account
        CImSmtpSettings* smtpSettings = new(ELeave) CImSmtpSettings;
        CleanupStack::PushL(smtpSettings);    
            CImIAPPreferences* smtpIap = CImIAPPreferences::NewLC();
    
                emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *smtpIap);
    
                _LIT(KServerAddress, "smtp.gmail.com")
                smtpSettings->SetServerAddressL(KServerAddress);
    
                _LIT(KEmailAlias, "chenziteng");
                smtpSettings->SetEmailAliasL(KEmailAlias);
    
                _LIT(KEmailAddress, "chenziteng@gmail.com");
                smtpSettings->SetEmailAddressL(KEmailAddress);
                smtpSettings->SetReplyToAddressL(KEmailAddress);
                smtpSettings->SetReceiptAddressL(KEmailAddress);
    
                smtpSettings->SetSMTPAuth(ETrue); // <==
    
                _LIT8(KUserName, "chenziteng");
                smtpSettings->SetLoginNameL(KUserName);
    
                _LIT8(KPassword, "**********"); // certainly I won't tell you my password
                smtpSettings->SetPasswordL(KPassword);
    
                smtpSettings->SetSSLWrapper(ETrue); // <==
                smtpSettings->SetPort(465); // <==
    
                TSmtpAccount smtpAccount = emailAccounts->CreateSmtpAccountL(pop3Account, *smtpSettings, *smtpIap, EFalse);
    
            CleanupStack::PopAndDestroy(smtpIap);
        CleanupStack::PopAndDestroy(smtpSettings);
    CleanupStack::PopAndDestroy(emailAccounts);
    Regards

    Ziteng Chen

  3. #3
    Registered User
    Join Date
    Nov 2004
    Location
    Oulu, Finland
    Posts
    21

    Re: Creating a Gmail account

    Yes indeed, it works. Thank you very much.

Similar Threads

  1. Problem in creating IMAP account
    By pavarang in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2009-04-29, 11:55
  2. How to access the mails from an gmail account
    By iworktech_kiran in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2009-02-04, 14:39
  3. Problem in build with S60 1FP
    By Manuelito_ in forum Symbian Tools & SDKs
    Replies: 14
    Last Post: 2007-09-18, 12:08
  4. Creating a custom MTM account in s60
    By tbernard1 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-06-28, 14:18
  5. Problem with bldmake bldfiles for Series 60 SDK 6.1
    By dml in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×