
Class for sending mail
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
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
7 years ago
Report
anahit
8 years ago
Report
stuk
8 years ago
Report
bloodshadow
8 years ago
Report
Raketten
9 years ago
Trying to send mail to smtp.gmail.com
Pls HELP
Report
bloodshadow
9 years ago
You need only OpenSSL
Report
Raketten
9 years ago
Report
carpovpv
9 years ago
Report
bloodshadow
9 years ago
Report