Class for sending mail
Qt Components
Score 54%
Description:

This class may be used for sending mail via smtp-server with authorization and with ssl protection or no.
Class consists ofi two data-parts:
1. SmtpAuthData struct which used for smtp server authorizaton;
2. And other class data for Mail

Example for minimal succeed class work

SmtpAuthData smtpAuthData;
SmtpAuthData::Data data;
// your email address
data.email = "";
// login for your email account
data.login = "";
// password for auth on email account
data.password = "";
smtpAuthData.rewriteData(data);

// set up smtp auth account data
Letter letter(smtpAuthData);

// mail to:
QString receivers = "";
letter.set_receivers(receivers);

// and than send letter
letter.send();

You may attach files to letter, put
absolutefilePath to QStringList and than call function with Letter object:
Letter::set_attachement(QStringList list)

Class support 5 different encodings:
utf-8, windows-1251, koi8-u, koi8-r and macintosh, set encoding very simple call function with Letter object:
Letter::set_encoding("encoding")

Class support blind carbon copy(Bcc),
Letter::letter.set_blindCopyReceivers(QString bl_receivers)

Names in the fields may be in non ascii characters, it depends on coding which be setted with Letter::set_encoding("encoding") (windows-1251 default)

If smtp server doesn't support EHLO mode clas try to connect with HELO mode


Update: if you don't have installed openSSL libraries, there a brief instruction:
1. Open Win32 OpenSSL Installation Project page.
2. Download the latest "light" Win32 or Win64 installation package, for example "Win32 OpenSSL v0.9.8l Light".
3. Install it to any location. Ignore "Microsoft Visual C++ 2008 Redistributables" warning (click OK) and select copying OpenSSL DLLs to "The OpenSSL binaries (\bin) directory".
4. Copy libeay32.dll and ssleay32.dll from the \bin folder to the same place where your QtNetwork4.dll or QtNetworkd4.dll is located.

mohanakannan

4 years ago

It is showing that"It could not be decoded with Uft-8..And showing many errors..Could not be builded..Please help me

Report

anahit

4 years ago

Thank you very much. It was very useful.

Report

stuk

5 years ago

Nice but you have to improve the Header of mail. The email date is not rfc2822 and you have to add MIME header for the type of the file you attach. For the date i fixed that if you want contact me.

Report

C

bloodshadow

5 years ago

Ok, later (1-2 weeks) I refactor code that was written (add TLS support)

Report

Raketten

6 years ago

This is just what I need, but I get Error during SSL handshake: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number as soon as I enable SSL in both windows and Fedora...

Trying to send mail to smtp.gmail.com

Pls HELP

Report

C

bloodshadow

6 years ago

Your SSL is OpenSSL ?
You need only OpenSSL

Report

Raketten

6 years ago

my mistake - I was tryng to send ssl encrypted mail to TLS port....gmail uses 465 for SSL...

Report

carpovpv

6 years ago

Thank you. Qt has only basic network capabilities and such a class is really useful.

Report

C

bloodshadow

6 years ago

Thank you :)

Report

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
1.0
updated Apr 20 2011
added Apr 16 2011
downloads today
0
page views today 0