Class for sending mail

Qt Components

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

0
Become a Fan
6.1

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:ata 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.

Ratings & Comments

9 Comments

mohanakannan

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

anahit

Thank you very much. It was very useful.

stuk

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.

bloodshadow

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

Raketten

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

bloodshadow

Your SSL is OpenSSL ? You need only OpenSSL

Raketten

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

carpovpv

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

bloodshadow

Thank you :)

Pling
0 Affiliates
Details
license
version 1.0
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 5

More Qt Components from bloodshadow:

Link Label
bloodshadow
last update date: 14 years ago

Score 5.7

Other Qt Components:

QyurVisualSqlFilter
purser79
last update date: 8 years ago

Score 5.0

QyurSqlTreeView
purser79
last update date: 8 years ago

Score 6.5

QtBasic
mantur
last update date: 12 years ago

Score 5.0

up2Date
seanpatti
last update date: 9 years ago

Score 5.0

MStyles
mchara
last update date: 17 years ago

Score 5.0

Hdr reading plugin
mchara
last update date: 17 years ago

Score 5.0