Results 1 to 20 of 35

Thread: Sending email using Qt.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Sending email using Qt.

    I rewrite the troll sample to make SMTP AUTH LOGIN work on qmail & postix tested...

    Important is the mail date ..... the troll sample go unixtime zero 1970....

    Qt Code:
    1. int dateswap(QString form, uint unixtime )
    2. {
    3. QDateTime fromunix;
    4. fromunix.setTime_t(unixtime);
    5. QString numeric = fromunix.toString((const QString)form);
    6. bool ok;
    7. return (int)numeric.toFloat(&ok);
    8. }
    9.  
    10.  
    11. QString TimeStampMail()
    12. {
    13. /* mail rtf Date format! http://www.faqs.org/rfcs/rfc788.html */
    14. uint unixtime = (uint)time( NULL );
    15. QDateTime fromunix;
    16. fromunix.setTime_t(unixtime);
    17. QStringList RTFdays = QStringList() << "giorno_NULL" << "Mon" << "Tue" << "Wed" << "Thu" << "Fri" << "Sat" << "Sun";
    18. QStringList RTFmonth = QStringList() << "mese_NULL" << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
    19. QDate timeroad(dateswap("yyyy",unixtime),dateswap("M",unixtime),dateswap("d",unixtime));
    20. /*qDebug() << "### RTFdays " << RTFdays.at(timeroad.dayOfWeek());
    21.   qDebug() << "### RTFmonth " << RTFmonth.at(dateswap("M",unixtime));
    22.   qDebug() << "### yyyy " << dateswap("yyyy",unixtime);
    23.   qDebug() << "### M " << dateswap("M",unixtime);
    24.   qDebug() << "### d " << dateswap("d",unixtime);*/
    25. QStringList rtfd_line;
    26. rtfd_line.clear();
    27. rtfd_line.append("Date: ");
    28. rtfd_line.append(RTFdays.at(timeroad.dayOfWeek()));
    29. rtfd_line.append(", ");
    30. rtfd_line.append(QString::number(dateswap("d",unixtime)));
    31. rtfd_line.append(" ");
    32. rtfd_line.append(RTFmonth.at(dateswap("M",unixtime)));
    33. rtfd_line.append(" ");
    34. rtfd_line.append(QString::number(dateswap("yyyy",unixtime)));
    35. rtfd_line.append(" ");
    36. rtfd_line.append(fromunix.toString("hh:mm:ss"));
    37. rtfd_line.append("");
    38. /*qDebug() << "### mail rtf Date format " << rtfd_line.join("");*/
    39. return QString(rtfd_line.join(""));
    40. }
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

  2. The following user says thank you to patrik08 for this useful post:

    lllturtle (16th August 2011)

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.