Results 1 to 9 of 9

Thread: Command prompts in qt

  1. #1
    Join Date
    May 2013
    Posts
    28
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60 Android

    Unhappy Command prompts in qt

    Hi friends,
    I want to send mail in Qt…For that i have gone through many sites and forums and cant able to get a clear picture……On that way,i have found that ,through command prompt commands,we can send email with attachments etc…..Did anyone know,how to use those command prompt commands in Qt to send mail.I have been strucking in this for more than 20 days..Or is there any other options to send mail in Qt without command prompt commands……Please help me..

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Command prompts in qt

    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. The following user says thank you to Santosh Reddy for this useful post:

    mohanakannan (12th July 2013)

  4. #3
    Join Date
    May 2013
    Posts
    28
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60 Android

    Unhappy Re: Command prompts in qt

    Thank you Mr. SanthoshReddy,
    I have gone through all these things,which you have provided.........In each thing,it is saying only one thing,STARTTLS command is needed......I'm a newbie...I cant able to sought out the problem....Please kindly help me..

  5. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Command prompts in qt

    I don't think the first link uses it. Try to read more about it.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  6. The following user says thank you to Santosh Reddy for this useful post:

    mohanakannan (12th July 2013)

  7. #5
    Join Date
    Feb 2013
    Location
    India
    Posts
    153
    Thanks
    27
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Command prompts in qt

    You can use QProcess to execute command prompt commands..

  8. The following user says thank you to karankumar1609 for this useful post:

    mohanakannan (12th July 2013)

  9. #6
    Join Date
    May 2013
    Posts
    28
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60 Android

    Default Re: Command prompts in qt

    thanks mr.karankumar ...
    i'm using this command "sendemail -f fromuser@gmail.com -t touser@domain.com -u subject -m "message" -s smtp.gmail.com -o tls=yes -xu gmailaccount -xp gmailpassword "........how to use this in qt...i have tried to put whole thing in the start(.........).
    but it is showing error..how to proceed.Thanks in advance


    Added after 18 minutes:


    thanks mr.santhosh reddy...
    i got the error SmtpMime has no such directory...When i run this below code

    #include <QtGui/QApplication>
    #include "../src/SmtpMime"-------------------------------------------->ERROR:No such file or directory...

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    // First create the SmtpClient object and set the user and the password.

    SmtpClient smtp("smtp.gmail.com", 465, SmtpClient::SslConnection);

    smtp.setUser("your_email_address@gmail.com");
    smtp.setPassword("your_password");

    // Create a MimeMessage

    MimeMessage message;

    message.setSender(new EmailAddress("your_email_address@gmail.com", "Your Name"));
    message.addRecipient(new EmailAddress("recipient@host.com", "Recipient's Name"));
    message.setSubject("SmtpClient for Qt - Demo");

    // Add some text

    MimeText text;
    text.setText("Hi!\n This is an email with some attachments.");
    message.addPart(&text);

    // Now we create the attachment object
    MimeAttachment attachment (new QFile("image1.jpg"));

    // the file type can be setted. (by default is application/octet-stream)
    attachment.setContentType("image/jpg");

    // Now add it to message
    message.addPart(&attachment);

    // Add an another attachment
    message.addPart(new MimeAttachment(new QFile("document.pdf")));

    // Now we can send the mail

    smtp.connectToHost();
    smtp.login();
    smtp.sendMail(message);
    smtp.quit();

    }
    Last edited by mohanakannan; 12th July 2013 at 10:45.

  10. #7
    Join Date
    Feb 2013
    Location
    India
    Posts
    153
    Thanks
    27
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Command prompts in qt

    Your same thread is already exists
    http://www.qtcentre.org/threads/5524...ht=#post247097

    Now you have to google "How to use QProcess" and learn about it.
    Or Go through to QProcess class.
    It will help you..

  11. The following user says thank you to karankumar1609 for this useful post:

    mohanakannan (12th July 2013)

  12. #8
    Join Date
    May 2013
    Posts
    28
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60 Android

    Default Re: Command prompts in qt

    thanks mr.KarannKumar,
    Ya i forgot to tell in that thread...I have tried using QProcess,,,but it doesn't send anything....When i use qDebug to know what it carries,it simply displays some 0x233323,some thing like that...It never send anything...

  13. #9
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Command prompts in qt

    Did you download and put SmtpClient src folder and place in appropriate path?, if not you need to do so.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Replies: 7
    Last Post: 20th October 2012, 13:44
  2. Replies: 12
    Last Post: 19th July 2012, 21:22
  3. Replies: 3
    Last Post: 23rd February 2011, 08:50
  4. What does this command mean?
    By mr.dct in forum Newbie
    Replies: 14
    Last Post: 23rd March 2010, 09:52
  5. Replies: 4
    Last Post: 14th July 2009, 03:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.