Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qml: sending email with Qt.openUrlExternally
Forum Updated to NodeBB v4.3 + New Features

Qml: sending email with Qt.openUrlExternally

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 5.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QtTuomi
    wrote on last edited by
    #1

    Hello everybody,

    I'm new to Qml and I'm trying to write an app, which should send an email when clicking a mouse area. This is, what I have already written:

    @
    // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
    import QtQuick 1.1

    Rectangle {
    id: rectangle1
    width: 360
    height: 360
    MouseArea {
    id: sendButton
    width: parent.width/2
    height: parent.height/2
    anchors.horizontalCenter: parent.horizontalCenter
    anchors.verticalCenter: parent.verticalCenter
    onClicked: {
    Qt.openUrlExternally("mailto: to@adress.com" +
    "?subject=This is a subject" +
    "&body=This is the message")
    }

        Text {
            id: textSendeMail
            text: qsTr("Sende Mail")
            font.family: "MS Shell Dlg 2"
            anchors.fill: parent
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignHCenter
            font.pixelSize: 16
        }
    }
    

    }
    @

    Now, when clicking this area, Outlook starts. I mean, this is clear, as the name says to open the url externally. But is there a way to send an email directly, without opening Outlook.

    I wrote such a function in C# already, maybe it would be easier to understand, what I mean, when I just show you the C#-Code:

    @
    MailMessage message = new MailMessage();
    message.Subject = "This is the subject";
    message.Body = "Here is the message";
    message.From = new MailAddress("noreply@myaddress.com");
    message.To = new MailAddress("destination@address.com");
    SmtpClient smtp = new SmtpClient(ip);
    smtp.Send(message);
    @

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      The QtQuick module itself doesn't provide any support for this. There are a number of plugins available, including a Messaging plugin (see http://doc.qt.nokia.com/qtmobility/qml-plugins.html for the list of plugins), though from a quick look it appears it only supports reading messages. If that is the case, you might need to write your own C++ plugin to handle this functionality.

      Regards,
      Michael

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved