SmtpClient-for-Qt/README.md

95 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2012-08-09 19:34:56 +00:00
SMTP Client for Qt (C++) - Version 1.1
2011-11-18 20:30:03 +00:00
=============================================
2011-09-03 17:39:09 +00:00
2011-09-03 18:45:54 +00:00
The SmtpClient for Qt is small library writen for Qt 4 (C++ version) that allows application to send complex emails (plain text, html, attachments, inline files, etc.) using the Simple Mail Transfer Protocol (SMTP).
2011-09-03 18:03:28 +00:00
2017-04-17 07:27:42 +00:00
## New in version 1.1:
2012-08-09 19:34:56 +00:00
- TLS (STARTTLS) connection is now supported
- multiple types of recipients (to, cc, bcc)
- nested mime emails (mixed/alternative, mixed/related)
- output compilant with RFC2045
2011-09-03 18:03:28 +00:00
2011-09-03 18:45:54 +00:00
## SMPT Client for Qt supports
2011-09-03 18:03:28 +00:00
2011-09-03 18:08:48 +00:00
- TCP and SSL connections to SMTP servers
2011-09-03 18:03:28 +00:00
2011-09-08 16:37:27 +00:00
- SMTP authentication (PLAIN and LOGIN methods)
2011-09-03 18:03:28 +00:00
2011-09-03 18:05:18 +00:00
- sending MIME emails (to multiple recipients)
2011-09-03 18:03:28 +00:00
2011-09-03 18:05:18 +00:00
- plain text and HTML (with inline files) content in emails
2011-09-03 18:03:28 +00:00
2011-09-03 18:08:48 +00:00
- multiple attachments and inline files (used in HTML)
2011-09-03 18:03:28 +00:00
2011-09-08 16:37:27 +00:00
- different character sets (ascii, utf-8, etc) and encoding methods (7bit, 8bit, base64)
2011-09-03 18:03:28 +00:00
2011-09-03 18:05:18 +00:00
- error handling
2011-09-03 18:45:54 +00:00
## Examples
Lets see a simple example:
2011-09-08 12:15:14 +00:00
```c++
#include <QtGui/QApplication>
#include "../src/SmtpMime"
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
// This is a first demo application of the SmtpClient for Qt project
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
// First we need to create an SmtpClient object
// We will use the Gmail's smtp server (smtp.gmail.com, port 465, ssl)
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
SmtpClient smtp("smtp.gmail.com", 465, SmtpClient::SslConnection);
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
// We need to set the username (your email address) and the password
// for smtp authentification.
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
smtp.setUser("your_email_address@gmail.com");
smtp.setPassword("your_password");
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
// Now we create a MimeMessage object. This will be the email.
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
MimeMessage message;
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
message.setSender(new EmailAddress("your_email_address@gmail.com", "Your Name"));
message.addRecipient(new EmailAddress("recipient@host.com", "Recipient's Name"));
message.setSubject("SmtpClient for Qt - Demo");
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
// Now add some text to the email.
// First we create a MimeText object.
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
MimeText text;
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
text.setText("Hi,\nThis is a simple email message.\n");
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
// Now add it to the mail
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
message.addPart(&text);
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
// Now we can send the mail
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
smtp.connectToHost();
smtp.login();
smtp.sendMail(message);
smtp.quit();
2011-09-03 18:45:54 +00:00
2011-09-08 12:15:14 +00:00
}
```
2011-09-03 18:45:54 +00:00
2011-09-06 21:46:36 +00:00
For more examples see the [Wiki/Examples](https://github.com/bluetiger9/SmtpClient-for-Qt/wiki/Examples).
2011-09-03 18:45:54 +00:00
## License
2012-07-24 14:06:55 +00:00
This project (all files including the demos/examples) is licensed under the GNU LGPL, version 2.1.
2011-09-03 18:45:54 +00:00
2011-09-07 12:57:51 +00:00
2011-09-03 18:45:54 +00:00
**Copyright (c) 2011 - Tőkés Attila**