Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor narendar_discover's Avatar
    Join Date
    Oct 2007
    Location
    India
    Posts
    349
    Email:
    There may be two ways to send mail.
    1) Using QtMobility API
    2) Using Defualt EMail Client

    Code using QtMobility

    //Headers
    #include <QMessage>
    #include <QMessageService>

    .pro will contain -> MOBILITY += messaging

    // Actual Code
    QMessageService* msgAction = new QMessageService(this);
    QMessage msg;
    msg.setType(QMessage::Email);
    msg.setTo(QMessageAddress(QMessageAddress::Email,"narendardiscover@gmail.com"));
    msg.setSubject("Test Subject");
    msg.setBody("Welcome to Home");
    QStringList attachments;
    attachments.append(":/res/icon.png");
    msg.appendAttachments(attachments);
    //Send email message
    qDebug()<<"Sending Status = "<<msgAction->send(msg);

    Code using Default Email Client

    //Headers
    #include <QDesktopServices>
    #include <QUrl>

    //Actual Code
    QDesktopServices:penUrl(QUrl(tr("mailto:narendardiscover@gmail?subject=Test Subject&body=Welcome to Home")));

    // Capability used for both ways
    Symbian:TARGET.CAPABILITY += NetworkServices
    Last edited by narendar_discover; 2011-04-21 at 09:20.

  2. #2
    Regular Contributor pixsta's Avatar
    Join Date
    Apr 2008
    Posts
    442
    I am interested in this as well. How can I send an email with an attachment using the default email client. I mean something like
    Code:
    QDesktopServices:penUrl(QUrl(tr("mailto:narendardiscover@gmail?subject=Test Subject&body=Welcome to Home&attachement=c:\sampleimage.jpg")));

  3. #3
    Registered User mvuori's Avatar
    Join Date
    Jul 2008
    Posts
    90
    Quote Originally Posted by pixsta View Post
    I am interested in this as well. How can I send an email with an attachment using the default email client. I mean something like
    Code:
    QDesktopServices:penUrl(QUrl(tr("mailto:narendardiscover@gmail?subject=Test Subject&body=Welcome to Home&attachement=c:\sampleimage.jpg")));
    You can do it wih QDesktopServices:: openUrl (), but you add the attachment with attach field, not attachment.
    And of course you use double backslashes and most likely don't tr the whole URL...

Similar Threads

  1. Sending image programmatically, fallback using default email client?
    By tvinke in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2008-10-01, 14:20
  2. Replies: 3
    Last Post: 2007-02-18, 14:44
  3. Replies: 1
    Last Post: 2006-08-18, 09:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved