Results 1 to 8 of 8

Thread: Receiving Mail only in the format of Plain Text Using QTcpSocket in SMTP

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Sep 2013
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Receiving Mail only in the format of Plain Text Using QTcpSocket in SMTP

    thanks for your suggestion..Guru
    But
    I had tried that ,
    using that document only i had send a mail.
    when i set a content type as HTML and Header name .
    it also considering as Plain text
    hear i attached my coding only the body content


    Qt Code:
    1. Smtp::Smtp( const QString &from, const QString &to, const QString &subject , const QString &body ,const QString &address,int port)
    2. {
    3. socket = new QTcpSocket(this);
    4. connect( socket, SIGNAL(readyRead()), this, SLOT( readyRead() ) );
    5. connect( socket, SIGNAL( connected()), this, SLOT( connected() ) );
    6. connect(socket, SIGNAL(disconnected()), this,SLOT(disconnected()));
    7. message = "To: " + to + "\n";
    8. message.append("From: " + from + "\n");
    9. message.append("Subject: " + subject + "\n");
    10. //Let's intitiate multipart MIME with cutting boundary "frontier"
    11. message.append("MIME-Version: 1.0\n");
    12. message.append("Content-Type: multipart/mixed; boundary=frontier\n\n");
    13. message.append( "--frontier\n" );
    14. //message.append( "Content-Type: text/html\n\n" ); //Uncomment this for HTML
    15. formating, coment the line below
    16. message.append( "Content-Type: text/html\n\n" );
    17.  
    18. message.append(body);
    19.  
    20. message.append("\n\n");
    21. message.append( "--frontier--\n" );
    22.  
    23. message.replace( QString::fromLatin1( "\n" ), QString::fromLatin1( "\r\n" ) );
    24.  
    25. message.replace( QString::fromLatin1( "\r\n.\r\n" ),QString::fromLatin1( "\r\n..\r\n" ) );
    26.  
    27. this->from = from;
    28. rcpt = to;
    29. state = Init;
    30. socket->connectToHost( address,port);//"172.17.72.36", 25);
    31. t = new QTextStream( socket );
    32. if(socket->waitForConnected ( 30000 ))
    33. {qDebug("connected"); }
    34. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by high_flyer; 4th September 2013 at 10:48. Reason: code tags

Similar Threads

  1. Sending mail Using Smtp Client
    By mohanakannan in forum Qt Programming
    Replies: 6
    Last Post: 5th July 2013, 10:47
  2. Replies: 9
    Last Post: 2nd March 2011, 11:58
  3. QTcpSocket slows down in receiving after several minutes
    By cutie.monkey in forum Qt Programming
    Replies: 1
    Last Post: 9th December 2009, 21:14
  4. QTcpSocket + receiving data
    By navi1084 in forum Qt Programming
    Replies: 1
    Last Post: 2nd June 2009, 08:10
  5. sending encrypted data via mail using smtp
    By vermarajeev in forum General Programming
    Replies: 20
    Last Post: 14th August 2007, 19:47

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.