Results 1 to 20 of 36

Thread: Sending email using Qt.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    5
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Sending email using Qt.

    Hello all! First I want to thank all of you. This information has been very helpful. With some minor modifications, I am now able to send an email via SMTP. The code that I am using was pasted from this forum and tweaked to get it to work with Qt4.6.2.

    I am having one issue though - my body text never gets transferred! What is happening? I get a subject line, but no body text. My ultimate goal is to attach a file, but I am a bit worried about accomplishing that if I cannot even get my body text to show up!

    It is this part of the code that I really do not understand. 1) Does it have to be done in this manner? 2) What is the purpose of the replaces? 3) How is SMTP getting my Subject Text, but not my Body Text? Any help is appreciated. (P.S. I am going to post this on another thread in order to make sure it gets seen).

    Qt Code:
    1. Smtp::Smtp( const QString &from, const QString &to, const QString &subject, const QString &body ) {
    2. ...
    3. sMessage = "To: " + to + "\n";
    4. sMessage.append("From: " + from + "\n");
    5. sMessage.append("Subject: " + subject + "\n");
    6. sMessage.append(body);
    7. sMessage.replace( QString::fromLatin1( "\n" ), QString::fromLatin1( "\r\n" ) );
    8. sMessage.replace( QString::fromLatin1( "\r\n.\r\n" ), QString::fromLatin1( "\r\n..\r\n" ) );
    9. sFrom = from;
    10. sTo = to;
    11. ...}
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending email using Qt.

    EDIT: Please don't post in multiple topics. It's considered rude. I posted a reply here only to notice that Wysota posted a reply in your other thread.

  3. #3
    Join Date
    Sep 2010
    Posts
    5
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Sending email using Qt.

    Quote Originally Posted by squidge View Post
    EDIT: Please don't post in multiple topics. It's considered rude. I posted a reply here only to notice that Wysota posted a reply in your other thread.
    Yes, yes, yes. I have already had my hand slapped. Won't happen again. Thank you for responding.

Similar Threads

  1. Replies: 9
    Last Post: 23rd August 2012, 00:01
  2. Replies: 7
    Last Post: 5th January 2009, 08:27
  3. Sending Mail through QProcess
    By KaptainKarl in forum Qt Programming
    Replies: 6
    Last Post: 13th August 2008, 21:51
  4. sending encrypted data via mail using smtp
    By vermarajeev in forum General Programming
    Replies: 20
    Last Post: 14th August 2007, 19:47
  5. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 09:23

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
  •  
Qt is a trademark of The Qt Company.