-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
- Loading branch information
1 parent
df94c4a
commit b620062
Showing
4 changed files
with
76 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#include <QtCore> | ||
|
||
#include "../../src/SimpleMail" | ||
|
||
#include <QtCore> | ||
|
||
using namespace SimpleMail; | ||
|
||
int main(int argc, char *argv[]) | ||
|
@@ -24,7 +24,6 @@ int main(int argc, char *argv[]) | |
server.setUsername(QLatin1String("[email protected]")); | ||
server.setPassword(QLatin1String("your_password")); | ||
|
||
|
||
// Now we create a MimeMessage object. This is the email. | ||
|
||
MimeMessage message; | ||
|
@@ -50,10 +49,10 @@ int main(int argc, char *argv[]) | |
|
||
// Add an attachment | ||
|
||
auto document = std::make_shared<MimeAttachment>(std::make_shared<QFile>(QLatin1String("document.pdf"))); | ||
auto document = | ||
std::make_shared<MimeAttachment>(std::make_shared<QFile>(QLatin1String("document.pdf"))); | ||
message.addPart(document); | ||
|
||
|
||
// Now create an SMime object | ||
|
||
auto smime = new SimpleMail::SMime(&message); | ||
|
@@ -63,15 +62,13 @@ int main(int argc, char *argv[]) | |
smime->setKeyFile("your_private_key.p12", "your_private_key_password"); | ||
smime->setPublicKey("recipient_public_key.cert"); | ||
|
||
|
||
// Sign the message. Only your private key is required. | ||
// if(!smime->sign()) { | ||
// qDebug() << "Failed to create signed email"; | ||
// delete smime; | ||
// return -3; | ||
// } | ||
|
||
|
||
// Encrypt the message. Only the recipient's public key/certificate is required. | ||
// if(!smime->encrypt()) { | ||
// qDebug() << "Failed to create encrypted email"; | ||
|
@@ -80,7 +77,7 @@ int main(int argc, char *argv[]) | |
// } | ||
|
||
// Sign and encrypt the message | ||
if(!smime->signAndEncrypt()) { | ||
if (!smime->signAndEncrypt()) { | ||
qDebug() << "Failed to create signed and encrypted email"; | ||
delete smime; | ||
return -3; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.