https://github.com/kelvins/smtpclient
:mailbox: A simple SMTP client to send e-mails using C++ and the Qt framework
https://github.com/kelvins/smtpclient
cpp email qt smtp smtp-client
Last synced: 4 months ago
JSON representation
:mailbox: A simple SMTP client to send e-mails using C++ and the Qt framework
- Host: GitHub
- URL: https://github.com/kelvins/smtpclient
- Owner: kelvins
- License: gpl-3.0
- Created: 2017-12-18T00:37:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-08T01:07:48.000Z (over 7 years ago)
- Last Synced: 2025-05-08T02:48:10.492Z (5 months ago)
- Topics: cpp, email, qt, smtp, smtp-client
- Language: C++
- Homepage:
- Size: 30.3 KB
- Stars: 14
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SMTPClient
A simple [SMTP (Simple Mail Transfer Protocol)][1] client to send e-mails using C++ and the Qt framework.
## How to use
Just include it in your `.PRO` file, like this:
```
include( $$PWD/SMTPClient.pri )
```Then you can include the headers in your code:
```cpp
#include "SMTPClient/email.h"
#include "SMTPClient/smtpclient.h"
```And send the e-mail, for example:
```cpp
/**
* @brief Slot used to send the message.
*/
void MainWindow::sendEmail()
{
// Create the email object
Email email = createEmail();// Create the SMTPClient
client_ = new SMTPClient(ui->lineEditHost->text(),
ui->spinBoxPort->value());// Connection used to receive the results
connect(client_, SIGNAL(status(Status::e, QString)),
this, SLOT(onStatus(Status::e, QString)), Qt::UniqueConnection);// Try to send the email
client_->sendEmail(email);
}/**
* @brief Create and return an Email object based on the fields from the form.
*/
Email MainWindow::createEmail()
{
// Create the credentials EmailAddress
EmailAddress credentials(ui->lineEditEmailCredentials->text(),
ui->lineEditPasswordCredentials->text());// Create the from EmailAddress
EmailAddress from(ui->lineEditEmailFrom->text());// Create the to EmailAddress
EmailAddress to(ui->lineEditEmailTo->text());// Create the email
Email email(credentials,
from,
to,
ui->lineEditSubject->text(),
ui->textEditContent->toPlainText());return email;
}
```## License
This project was created under the [GNU General Public License v3.0][2].
[1]: https://pt.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
[2]: LICENSE