Coder Social home page Coder Social logo

cutelyst / simple-mail Goto Github PK

View Code? Open in Web Editor NEW
197.0 11.0 60.0 339 KB

An SMTP library written in C++ for Qt. Allows applications to send emails (MIME with text, html, attachments, inline files, etc.) via SMTP. Supports SSL and SMTP authentication.

License: GNU Lesser General Public License v2.1

CMake 8.00% C++ 91.73% C 0.27%
smtp smtp-authentication simplemail mime attachment recipients inline-files c-plus-plus c-plus-plus-11 qt

simple-mail's Introduction

Cutelyst - The Qt Web Framework Cutelyst logo

A Web Framework built on top of Qt, using the simple and elegant approach of Catalyst (Perl) framework.

Qt's meta object system is what powers the core of Cutelyst, it allows for introspecting controller's methods signatures and generate matching actions that can be invoked later.

BENCHMARKS

Don't trust us on being fast, check out the most comprehensive web framework benchmarks by TechEmpower http://www.techempower.com/benchmarks/

FEATURES:

  • Cross-platform
  • Stable API/ABI - v3 tagged from v3.x.x, v2 tags, v1 on v1.x.x branch (unmaintained)
  • Pluggable Engines
    • Cutelyst::Server - A cross-platform and fast server engine
      • HTTP/1.1 - Pipelining and Keep-Alive
      • HTTP/2 - Upgrade to H2, ALPN negotiation on HTTPS and direct H2C
      • FastCGI - Pipelining and Keep-Alive
  • WebSockets
  • REST with ActionREST
  • Plugin based views
    • Cutelee (A Qt implementation of Django's template engine)
    • JSON
    • Email
  • Dispatcher
    • Chained
    • Path
  • Plugins
    • Session
    • Authentication (with PBKDF2)
    • Authorization with RoleACL
    • StatusMessage
    • Validator (to validate user input)
    • CSRF protection
    • Memcached
    • UserAgent
  • Asynchronous processing (just don't use local QEventLoops or it will eventually crash)
    • Async SQL with ASql
  • Upload parser
  • JSON body as QJsonDocument when uploaded data is in JSON format
  • C++20
  • Chunked reponses (via QIODevice write API)
  • Request profiling/stats
  • Unit tested
  • QtCreator integration

DOCUMENTATION

Get started with our Tutorial or check the API.

COMMUNITY

The Cutelyst project IRC channel is #cutelyst on freenode.

Or you can use the Mailing List

REQUIREMENTS

  • CMake - for the build system (>= 3.16)
  • Qt - the core library of this framework (>= 6.2)

LICENSE

The source code is available is under the 3-Clause BSD.

simple-mail's People

Contributors

bluetiger9 avatar buschmann23 avatar czdanol avatar dantti avatar degitx avatar derdakon avatar langesebastian avatar ludekvodicka avatar m393 avatar manugc avatar mkumas avatar pre-commit-ci[bot] avatar raineforest avatar sjinks avatar steinachim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simple-mail's Issues

Unknown CMake command "qt5_wrap_ui"

I've never worked with CMake before so it is very possible I'm just doing something wrong, but when generating the CMakeList.txt, I'm getting the error described in the title. Could someone explain how this could be fixed?

Best regards,
Konst

How to compile this library in Windows

I was able to compile and use this library on my Linux box, but on Windows I'm not able to compile this library. I have used QTCreator which is capable to deal with CMake-files but during the compiling process I've got first tons of such warnings:

C:\Users\kottmann_h\Documents\QT\simple-mail-master\src\emailaddress.cpp:22: warning: 'SimpleMail::EmailAddress::EmailAddress()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
EmailAddress::EmailAddress() : d_ptr(new EmailAddressPrivate)

and at the end tons of such linker errors:

C:\Users\kottmann_h\Documents\QT\simple-mail-master\src\emailaddress.cpp:22: error: undefined reference to `__imp__ZTVN10SimpleMail12EmailAddressE'

The library upon which this library is based on I was able to compile, but it was not working:

https://github.com/bluetiger9/SmtpClient-for-Qt

SimpleMail gets stuck in somewhere and don't report a timeout

Hi,

I'm trying to use SimpleMail in my app and would like to thank you for your efforts. I'm using it asynchronously and it does not respond back in my current condition. Let me explain what's going on:

Note: I'm using C++17 and trying to use it like in the example, with little differences.

Here's my variable definitions in the header:

    SimpleMail::Server server;
    SimpleMail::ServerReply *serverReply = nullptr;
    SimpleMail::MimeText *mimeText = nullptr;

Here's the SimpleMail server configuration in the constructor:

    server.setHost(smtpHost);
    server.setPort(smtpPort);
    server.setConnectionType(SimpleMail::Server::SslConnection);
    server.setUsername(senderAddr);
    server.setPassword(senderPw);

The parameters are all defined as static constexpr char[] for test purposes.

Here's the actual send sequence:

        SimpleMail::MimeMessage message;
        message.setSender(SimpleMail::EmailAddress(senderAddr, senderName));
        message.addTo(SimpleMail::EmailAddress(recipient));
        message.setSubject(subject);

        // First we create a MimeText object.
        // This must be created with new otherwise it will be deleted once we leave the scope.
        mimeText = new SimpleMail::MimeText;

        // Now add some text to the email.
        mimeText->setText(body);

        // Now add it to the mail
        message.addPart(mimeText);

        // Now we can send the mail
        sendOperationCompleted = false;
        serverReply = server.sendMail(message);
        QObject::connect(serverReply, &SimpleMail::ServerReply::finished, [this] {
            this->sendOperationCompleted = true;
            if(this->serverReply->error())
            {
                this->threadResult = Result::Code::netSmtpError;
                this->smtpErrorText = this->serverReply->responseText();
            }
            else
            {
                this->threadResult = Result::Code::success;
            }
            this->triggerThread();
        });

I've removed most of the irrelevant code to simplify the case.

Here's the log send by SimpleMail:

simplemail.server: Connecting to host encrypted "smtp.gmail.com" 465
simplemail.server: stateChanged QAbstractSocket::HostLookupState ""
simplemail.server: stateChanged QAbstractSocket::ConnectingState ""
simplemail.server: stateChanged QAbstractSocket::ConnectedState ""
simplemail.server: connected 2 ""
simplemail.server: readyRead 53
simplemail.server: Got response "220 smtp.gmail.com ESMTP kz3sm2422235ejc.71 - gsmtp" expected 220
simplemail.server: readyRead 0
simplemail.server: readyRead 222
simplemail.server: Got response "250-smtp.gmail.com at your service, [xxx.xxx.xxx.xxx]"
simplemail.server: Got response "250-SIZE 35882577"
simplemail.server: Got response "250-8BITMIME"
simplemail.server: Got response "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
simplemail.server: Got response "250-ENHANCEDSTATUSCODES"
simplemail.server: Got response "250-PIPELINING"
simplemail.server: Got response "250-CHUNKING"
simplemail.server: Got response "250 SMTPUTF8"
simplemail.server: CAPS ("250-smtp.gmail.com at your service, [xxx.xxx.xxx.xxx]", "250-SIZE 35882577", "250-8BITMIME", "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH", "250-ENHANCEDSTATUSCODES", "250-PIPELINING", "250-CHUNKING", "250 SMTPUTF8")
simplemail.server: LOGIN SimpleMail::Server::AuthPlain
simplemail.server: Sending authentication plain 4
simplemail.server: readyRead 0
simplemail.server: readyRead 20
simplemail.server: Got response "235 2.7.0 Accepted" expected 235
simplemail.server: Sending MAIL command true 3 ("MAIL FROM:<[email protected]>\r\n", "RCPT TO:<[email protected]>\r\n", "DATA\r\n") (250, 250, 354)
simplemail.server: readyRead 0
simplemail.server: readyRead 41
simplemail.server: Got response "250 2.1.0 OK kz3sm2422235ejc.71 - gsmtp"
simplemail.server: readyRead 0
simplemail.server: readyRead 41
simplemail.server: Got response "250 2.1.5 OK kz3sm2422235ejc.71 - gsmtp"
simplemail.server: readyRead 0
simplemail.server: readyRead 42
simplemail.server: Got response "354  Go ahead kz3sm2422235ejc.71 - gsmtp"
simplemail.server: Mail sent
simplemail.server: readyRead 0

The state machine of SimpleMail gets stuck in this phase and there is nothing to save it from this state. So I'm planning to add a timeout logic with a QTimer. But first, I need to understand what's wrong right now.

This is the Wireshark capture of the sequence:

image

From what I see, mail body is sent and ACK is received from the SMTP server, but it does not respond back with some feedback and SimpleMail just waits for it forever.

How can I solve the issue? What am I doing wrong?

Edit:

Took a log from Thunderbird for the same operation and seen that this response is missing indeed:

Response: 250 2.0.0 OK  1640334423 y11sm2476362ejw.147 - gsmtp

Therefore the following code is never called and SimpleMail gets stuck in the ServerReplyContainer::SendingData state forever (at least till to the TCP close from the remote party).

                    } else if (cont.state == ServerReplyContainer::SendingData) {
                        QByteArray responseText;
                        const int code = parseResponseCode(&responseText);
                        if (!cont.reply.isNull()) {
                            ServerReply *reply = cont.reply;
                            queue.removeFirst();
                            reply->finish(code != 250, code, QString::fromLatin1(responseText));
                        } else {
                            queue.removeFirst();
                        }
                        qCDebug(SIMPLEMAIL_SERVER) << "MAIL FINISHED" << code << queue.size() << socket->canReadLine();

                        processNextMail();
                    }

How to Install this

Hi there. I cant find a singular straight forward guide as to how to install/use this library in my Qt C++ project. I'd appreciate it if you could help me out.

Not using Qt

So, when you say it's for Qt, does that mean it can't be used in a regular desktop C++ MFC application?

Critical error detected

Hello, writing code like this:

using namespace SimpleMail;

SimpleMail::Sender smtp("smtp.gmail.com", 465, SimpleMail::Sender::SslConnection);
smtp.setUser("[email protected]");
smtp.setPassword("password");
MimeMessage message;
message.setSender(EmailAddress("[email protected]", "username"));
message.addTo(EmailAddress("[email protected]", "username"));
message.setSubject("SmtpClient for Qt - Demo");
if (!smtp.sendMail(message)) {
	qDebug() << "Failed to send mail!" << smtp.lastError();
}
smtp.quit();

And always getting Critical error detected c0000374 - C++. Email is send successful, but after that error occurs. Where could problem be?

Sending files using QFile in async mode

When adding a file as a mime part it looks like the QFile is expected to be on the heap to persist beyond the caller lifetime. Okay, so far so good, that is easy to do. So I call it with a fragment like:

    QFile* file = new QFile(filePath);
    if (!file->exists()) return(false);
    SimpleMail::MimeFile* mimeFile = new SimpleMail::MimeFile(file);
    pMessage->addPart(mimeFile );

But I cannot find that the SimpleMail::MimeFile object takes ownership or ever calls a delete on the QFile object. Am I missing something? Or, if disposing of the QFile object remains the callers concern, when it is safe to do so? (Say after a return from server->sendMail(*pMessage) )?

And I have really come to appreciate how well designed your Server class is now that we have moved away from the demo1~4 code with its blocking approach.

SMTP response code too strict

The server will indeed return 250 to most commands, but e.g. 251 is permitted at some places. Basically one should see any 2xx code as success for most normal commands (i.e. after the EHLO).

Adding to Qt project throws "unresolved external symbol" errors

I am currently trying to add this library to my Qt project but I have never done this before.
I've looked through the Qt documentation on adding external libraries and have found and tried some ways to add the library, but they all failed.

I've tried:

  • adding the path to the src folder to my project's .pro file like this: INCLUDEPATH += "../Simple-Mail/src"
  • creating a .pri file in the Simple-Mail folder, adding INCLUDEPATH += ./src to it and using !include( ../Simple-Mail/SimpleMail.pri ) {} to include it in my main .pro file
  • using a raw path to access the headers (#include "../Simple-Mail/src/SmtpMime")

Every time the syntax highlighting, code suggestions and linter didn't give me any errors but upon building my project I get about 20 "unresolved external symbol" errors.
What am I doing wrong?

Async example

Nice piece of code, just small thing. The example code you must in main MD page is not compiling...

Clean disconnect when buffer done?

If there a design reason the socket to the remote SMTP node is not closed when the buffer is emptied?
It appear to just leaves it open and after a bit of time the other side drops it.

readyRead unknown state "421 4.4.2 xxxhiddenxxx.com Error: timeout exceeded\r\n"

Crash on blocking example (Windows, Qt5.12.4, MSVC)

Hi (again),

Sender.SendMail does not seem to be blocking therefore deletes the referred parts with qDeleteAll(parts), whereas we still require it. This happens when 'Sender' OR 'Message' go out of scope before mail is actually done sending.

MimeMultiPartPrivate::~MimeMultiPartPrivate() { qDeleteAll(parts); }

It works when changing to pointers instead of references.

On a side note to qDeleteAll(): We just had to many issues related to these meta clearing container macros/functions that we just replaced all qDelete*() calls with custom loop + take/delete.

C2491 'SimpleMail::Sender::staticMetaObject': definition of dllimport static data member not allowed (compiling source file SimpleMail\sender.cpp) C2491 'SimpleMail::Server::staticMetaObject': definition of dllimport static data member not allowed (compiling source file SimpleMail\server.cpp) Severity Code Description Project File Line Suppression State Error C2491 'SimpleMail::ServerReply::staticMetaObject': definition of dllimport static data member not allowed (compiling source file SimpleMail\serverreply.cpp)

mistake in demo1

In demo1 should be used pointer for MimeText *text = new MimeText() ;
because otherwise the app abortes on close, because it try to delete pointers in ~MimeMultiPartPrivate() function that were deleted previosly in app.

Building with MSVC?

Hey all, I stumled across your proyect, and upon trying to build it, I get warnings from msvc about dll linking being incoherent (sorry, badly translated from spanish)

Does the project have any specific requirements?

how to attach a QImage in the mail through the SimpleMail?

When I add a image, I found it only can receive a QFile pointer. I have a QImage object now, how can I convert the QImage to QFile? I don't want to save the QImage to local disk because it's an async opeartion and then I need to delete the file. Thanks.

Cleaning Up - Ownership?

In the demos, you often use following statement:
MimeAttachment document(new QFile(QLatin1String("document.pdf")));

Does the MimeAttachment care about deleting the QFile instance?
Or do I have to call file.deleteLater() ?

Thank you and greetings from Austria.

Erros in async1.cpp

/home/user/simple-mail/demos/async1/async1.cpp:22:105: error: incorrect converting from «const char*» в «int» [-fpermissive]
message.setSender(SimpleMail::EmailAddress(QLatin1String("[email protected]", "Your Name")));

I changed "Your Name" to a number, and compilation ended without errors.

I'm not a programmer, I can't check where I closing parenthesis.

Error "Invalid address specified to RtlValidateHeap" in release mode

Hi,
I have been using this library for a small application and in debug mode everything works just fine but when I try to run the program in release mode the application still sends the email but, right after is sent, the application crashes.
this is the error I get:
__cdecl SimpleMail::MimePart::~MimePart(void)
__cdecl SimpleMail::MimePart::~MimePart(void)
HEAP[Viewer.exe]: Invalid address specified to RtlValidateHeap( 00000169E72D0000, 0000169F571FA00 )

Could anyone help me with this?

Can not send email when bcc is used

Hi,

Let me start by saying you have done a tremendous job with this library.

I have been testing it for a while and found that it works well until i tried using the bcc function.
It failed at:
`if (!smtp.sendMail(message)) {

    qDebug() << "Failed to send mail!" << endl;
    return -3;
}`

when i use:
`if(bccSender) {

    EmailAddress bcc(fromEmail, fromName);
    message.addBcc(&bcc);
}`

I am sending thru gmail on windows 10 with Qt 5.9.1 dynamic build. I also have openssl installed.

Thanks

Async-Problem and possible fix

Hi.

First of all - thank you for making "simple-mail".

We experienced some problems with the async-version (the sync version worked without that problem!) and a colleague of mine investigated. He said that he was able to fix the problem by adding a line containing "\r\n.\r\n" to a mime-part.

The RFC specification seems to confirm that a mail must be terminated like that.

https://www.rfc-editor.org/rfc/rfc5321#section-4.5.2

I didn't work on the problem myself and don't know much about SMTP, so sorry for being a little vague on details (if necessary I can ask for more information). But I thought I should at least bring this to your attention.

Attached to this file you will find a patch file.

Thanks.

simplemail_patch.txt

Issues with Async example

There seems to be a lot of places in the async1.cpp example where you are depending on a space between the the response code and the rest of the response string if (responseText[3] == ' ') ...

Our server (made by Icewarp) replies with a space at times and at other times with "-" and the above logic will not work.
As in: "250-Node.xxxxx.net Hello YYYY [xx.xx.xx.xx], pleased to meet you."

My first thought is to go in and replace the above logic with if ((responseText[3] == ' ') || (responseText[3] == '-')) {
Is there a semantic meaning to the use of "-" that this would disturb?

Undefined references

Under Windows I get over a hundred of undefined references in MOC files when builiding the project. This doesn't happen under Ubuntu.
Can you reproduce it or is it my setup? I'm compiling with MinGW (172 errors) or Clang (114 errors) as MSVC won't work with this project at all.
image

How to use this - windows

I've read How to Install this but it's for linux as I see.
I followed the instructions and got libSimpleMail2Qt5.lib and libSimpleMail2Qt5.dll.
Build folder: build-simple-mail-2.2.0-Desktop_Qt_5_15_2_MSVC2019_64bit-Release

Next, I try to use it.
I copy all of the .h (+SimpleMail) files from simple-mail-2.2.0/src and use the "blocking" example. I build it, but I get 3 errors and a bunch of warnings:

x64\Debug\moc\moc_serverreply.cpp(67,1): warning C4273: 'SimpleMail::ServerReply::qt_static_metacall': inconsistent dll linkage
simple-mail\include\serverreply.h(28,5): message : see previous definition of 'qt_static_metacall' (compiling source file x64\Debug\moc\moc_serverreply.cpp)
x64\Debug\moc\moc_serverreply.cpp(88,82): warning C4273: 'staticMetaObject': inconsistent dll linkage
simple-mail\include\serverreply.h(28,5): message : see previous definition of 'public: static QMetaObject const SimpleMail::ServerReply::staticMetaObject' (compiling source file x64\Debug\moc\moc_serverreply.cpp)
x64\Debug\moc\moc_serverreply.cpp(88,82): error C2491: 'SimpleMail::ServerReply::staticMetaObject': definition of dllimport static data member not allowed
x64\Debug\moc\moc_serverreply.cpp(99,1): warning C4273: 'SimpleMail::ServerReply::metaObject': inconsistent dll linkage
simple-mail\include\serverreply.h(28,5): message : see previous definition of 'metaObject' (compiling source file x64\Debug\moc\moc_serverreply.cpp)
x64\Debug\moc\moc_serverreply.cpp(104,1): warning C4273: 'SimpleMail::ServerReply::qt_metacast': inconsistent dll linkage
simple-mail\include\serverreply.h(28,5): message : see previous definition of 'qt_metacast' (compiling source file x64\Debug\moc\moc_serverreply.cpp)
x64\Debug\moc\moc_serverreply.cpp(112,1): warning C4273: 'SimpleMail::ServerReply::qt_metacall': inconsistent dll linkage
simple-mail\include\serverreply.h(28,5): message : see previous definition of 'qt_metacall' (compiling source file x64\Debug\moc\moc_serverreply.cpp)
x64\Debug\moc\moc_serverreply.cpp(130,1): warning C4273: 'SimpleMail::ServerReply::finished': inconsistent dll linkage
simple-mail\include\serverreply.h(40,10): message : see previous definition of 'finished' (compiling source file x64\Debug\moc\moc_serverreply.cpp)
x64\Debug\moc\moc_server.cpp(126,1): warning C4273: 'SimpleMail::Server::qt_static_metacall': inconsistent dll linkage
simple-mail\include\server.h(31,5): message : see previous definition of 'qt_static_metacall' (compiling source file x64\Debug\moc\moc_server.cpp)
x64\Debug\moc\moc_server.cpp(154,77): warning C4273: 'staticMetaObject': inconsistent dll linkage
simple-mail\include\server.h(31,5): message : see previous definition of 'public: static QMetaObject const SimpleMail::Server::staticMetaObject' (compiling source file x64\Debug\moc\moc_server.cpp)
x64\Debug\moc\moc_server.cpp(154,77): error C2491: 'SimpleMail::Server::staticMetaObject': definition of dllimport static data member not allowed
x64\Debug\moc\moc_server.cpp(165,1): warning C4273: 'SimpleMail::Server::metaObject': inconsistent dll linkage
simple-mail\include\server.h(31,5): message : see previous definition of 'metaObject' (compiling source file x64\Debug\moc\moc_server.cpp)
x64\Debug\moc\moc_server.cpp(170,1): warning C4273: 'SimpleMail::Server::qt_metacast': inconsistent dll linkage
simple-mail\include\server.h(31,5): message : see previous definition of 'qt_metacast' (compiling source file x64\Debug\moc\moc_server.cpp)
x64\Debug\moc\moc_server.cpp(178,1): warning C4273: 'SimpleMail::Server::qt_metacall': inconsistent dll linkage
simple-mail\include\server.h(31,5): message : see previous definition of 'qt_metacall' (compiling source file x64\Debug\moc\moc_server.cpp)
x64\Debug\moc\moc_server.cpp(196,1): warning C4273: 'SimpleMail::Server::smtpError': inconsistent dll linkage
simple-mail\include\server.h(183,10): message : see previous definition of 'smtpError' (compiling source file x64\Debug\moc\moc_server.cpp)
x64\Debug\moc\moc_server.cpp(203,1): warning C4273: 'SimpleMail::Server::sslErrors': inconsistent dll linkage
simple-mail\include\server.h(184,10): message : see previous definition of 'sslErrors' (compiling source file x64\Debug\moc\moc_server.cpp)
x64\Debug\moc\moc_sender.cpp(144,1): warning C4273: 'SimpleMail::Sender::qt_static_metacall': inconsistent dll linkage
simple-mail\include\sender.h(32,5): message : see previous definition of 'qt_static_metacall' (compiling source file x64\Debug\moc\moc_sender.cpp)
x64\Debug\moc\moc_sender.cpp(200,77): warning C4273: 'staticMetaObject': inconsistent dll linkage
simple-mail\include\sender.h(32,5): message : see previous definition of 'public: static QMetaObject const SimpleMail::Sender::staticMetaObject' (compiling source file x64\Debug\moc\moc_sender.cpp)
x64\Debug\moc\moc_sender.cpp(200,77): error C2491: 'SimpleMail::Sender::staticMetaObject': definition of dllimport static data member not allowed
x64\Debug\moc\moc_sender.cpp(211,1): warning C4273: 'SimpleMail::Sender::metaObject': inconsistent dll linkage
simple-mail\include\sender.h(32,5): message : see previous definition of 'metaObject' (compiling source file x64\Debug\moc\moc_sender.cpp)
x64\Debug\moc\moc_sender.cpp(216,1): warning C4273: 'SimpleMail::Sender::qt_metacast': inconsistent dll linkage
simple-mail\include\sender.h(32,5): message : see previous definition of 'qt_metacast' (compiling source file x64\Debug\moc\moc_sender.cpp)
x64\Debug\moc\moc_sender.cpp(224,1): warning C4273: 'SimpleMail::Sender::qt_metacall': inconsistent dll linkage
simple-mail\include\sender.h(32,5): message : see previous definition of 'qt_metacall' (compiling source file x64\Debug\moc\moc_sender.cpp)
x64\Debug\moc\moc_sender.cpp(242,1): warning C4273: 'SimpleMail::Sender::smtpError': inconsistent dll linkage
simple-mail\include\sender.h(223,10): message : see previous definition of 'smtpError' (compiling source file x64\Debug\moc\moc_sender.cpp)
x64\Debug\moc\moc_sender.cpp(249,1): warning C4273: 'SimpleMail::Sender::sslErrors': inconsistent dll linkage
simple-mail\include\sender.h(224,10): message : see previous definition of 'sslErrors' (compiling source file x64\Debug\moc\moc_sender.cpp)

I'm using Visual Studio 2019

Build Failed With MSCV

I'm getting issues building this with MSCV. The previous version (simple-mail-1.4.0) did build without any issues. I am using VS2019, issue is still there with VS2017. I noticed another user had a similar issue and it was closed, not sure why. Here are the error messages.

1>------ Build started: Project: ZERO_CHECK, Configuration: Release x64 ------
1>Checking Build System
2>------ Build started: Project: SimpleMail2Qt5, Configuration: Release x64 ------
2>Automatic MOC for target SimpleMail2Qt5
2>sender.cpp
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(29): warning C4273: 'SimpleMail::Sender::Sender': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(70): note: see previous definition of '{ctor}'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(35): warning C4273: 'SimpleMail::Sender::Sender': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(71): note: see previous definition of '{ctor}'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(47): warning C4273: 'SimpleMail::Sender::~Sender': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(72): note: see previous definition of '{dtor}'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(52): warning C4273: 'SimpleMail::Sender::host': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(77): note: see previous definition of 'host'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(58): warning C4273: 'SimpleMail::Sender::setUser': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(124): note: see previous definition of 'setUser'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(67): warning C4273: 'SimpleMail::Sender::password': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(129): note: see previous definition of 'password'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(73): warning C4273: 'SimpleMail::Sender::setPassword': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(134): note: see previous definition of 'setPassword'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(82): warning C4273: 'SimpleMail::Sender::authMethod': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(139): note: see previous definition of 'authMethod'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(88): warning C4273: 'SimpleMail::Sender::setAuthMethod': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(144): note: see previous definition of 'setAuthMethod'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(94): warning C4273: 'SimpleMail::Sender::setHost': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(82): note: see previous definition of 'setHost'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(100): warning C4273: 'SimpleMail::Sender::port': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(87): note: see previous definition of 'port'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(106): warning C4273: 'SimpleMail::Sender::setPort': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(92): note: see previous definition of 'setPort'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(112): warning C4273: 'SimpleMail::Sender::name': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(98): note: see previous definition of 'name'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(118): warning C4273: 'SimpleMail::Sender::setName': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(104): note: see previous definition of 'setName'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(124): warning C4273: 'SimpleMail::Sender::connectionType': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(109): note: see previous definition of 'connectionType'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(130): warning C4273: 'SimpleMail::Sender::setConnectionType': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(114): note: see previous definition of 'setConnectionType'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(154): warning C4273: 'SimpleMail::Sender::user': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(119): note: see previous definition of 'user'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(160): warning C4273: 'SimpleMail::Sender::responseText': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(149): note: see previous definition of 'responseText'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(166): warning C4273: 'SimpleMail::Sender::responseCode': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(154): note: see previous definition of 'responseCode'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(172): warning C4273: 'SimpleMail::Sender::connectionTimeout': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(159): note: see previous definition of 'connectionTimeout'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(178): warning C4273: 'SimpleMail::Sender::setConnectionTimeout': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(164): note: see previous definition of 'setConnectionTimeout'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(184): warning C4273: 'SimpleMail::Sender::responseTimeout': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(169): note: see previous definition of 'responseTimeout'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(190): warning C4273: 'SimpleMail::Sender::setResponseTimeout': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(174): note: see previous definition of 'setResponseTimeout'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(195): warning C4273: 'SimpleMail::Sender::sendMessageTimeout': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(179): note: see previous definition of 'sendMessageTimeout'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(200): warning C4273: 'SimpleMail::Sender::setSendMessageTimeout': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(184): note: see previous definition of 'setSendMessageTimeout'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(206): warning C4273: 'SimpleMail::Sender::ignoreSslErrors': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(190): note: see previous definition of 'ignoreSslErrors'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(215): warning C4273: 'SimpleMail::Sender::ignoreSslErrors': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(197): note: see previous definition of 'ignoreSslErrors'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(224): warning C4273: 'SimpleMail::Sender::setPeerVerificationType': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(203): note: see previous definition of 'setPeerVerificationType'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(230): warning C4273: 'SimpleMail::Sender::peerVerificationType': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(209): note: see previous definition of 'peerVerificationType'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(236): warning C4273: 'SimpleMail::Sender::sendMail': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(211): note: see previous definition of 'sendMail'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(242): warning C4273: 'SimpleMail::Sender::lastError': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(213): note: see previous definition of 'lastError'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(248): warning C4273: 'SimpleMail::Sender::quit': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(215): note: see previous definition of 'quit'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(254): warning C4273: 'SimpleMail::Sender::socketStateChanged': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(218): note: see previous definition of 'socketStateChanged'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(258): warning C4273: 'SimpleMail::Sender::socketError': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(219): note: see previous definition of 'socketError'
2>D:\Dev\Cutelyst\simple-mail-master\src\sender.cpp(262): warning C4273: 'SimpleMail::Sender::socketReadyRead': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(220): note: see previous definition of 'socketReadyRead'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_sender.cpp(144): warning C4273: 'SimpleMail::Sender::qt_static_metacall': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(32): note: see previous definition of 'qt_static_metacall'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_sender.cpp(200): warning C4273: 'staticMetaObject': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(32): note: see previous definition of 'public: static QMetaObject const SimpleMail::Sender::staticMetaObject'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_sender.cpp(200): error C2491: 'SimpleMail::Sender::staticMetaObject': definition of dllimport static data member not allowed
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_sender.cpp(211): warning C4273: 'SimpleMail::Sender::metaObject': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(32): note: see previous definition of 'metaObject'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_sender.cpp(216): warning C4273: 'SimpleMail::Sender::qt_metacast': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(32): note: see previous definition of 'qt_metacast'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_sender.cpp(224): warning C4273: 'SimpleMail::Sender::qt_metacall': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(32): note: see previous definition of 'qt_metacall'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_sender.cpp(242): warning C4273: 'SimpleMail::Sender::smtpError': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(223): note: see previous definition of 'smtpError'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_sender.cpp(249): warning C4273: 'SimpleMail::Sender::sslErrors': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\sender.h(224): note: see previous definition of 'sslErrors'
2>server.cpp
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(30): warning C4273: 'SimpleMail::Server::Server': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(69): note: see previous definition of '{ctor}'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(38): warning C4273: 'SimpleMail::Server::~Server': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(70): note: see previous definition of '{dtor}'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(43): warning C4273: 'SimpleMail::Server::host': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(75): note: see previous definition of 'host'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(49): warning C4273: 'SimpleMail::Server::setHost': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(80): note: see previous definition of 'setHost'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(55): warning C4273: 'SimpleMail::Server::port': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(85): note: see previous definition of 'port'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(61): warning C4273: 'SimpleMail::Server::setPort': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(90): note: see previous definition of 'setPort'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(67): warning C4273: 'SimpleMail::Server::hostname': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(95): note: see previous definition of 'hostname'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(73): warning C4273: 'SimpleMail::Server::setHostname': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(101): note: see previous definition of 'setHostname'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(79): warning C4273: 'SimpleMail::Server::connectionType': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(106): note: see previous definition of 'connectionType'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(85): warning C4273: 'SimpleMail::Server::setConnectionType': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(111): note: see previous definition of 'setConnectionType'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(93): warning C4273: 'SimpleMail::Server::username': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(116): note: see previous definition of 'username'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(99): warning C4273: 'SimpleMail::Server::setUsername': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(121): note: see previous definition of 'setUsername'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(108): warning C4273: 'SimpleMail::Server::password': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(126): note: see previous definition of 'password'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(114): warning C4273: 'SimpleMail::Server::setPassword': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(131): note: see previous definition of 'setPassword'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(120): warning C4273: 'SimpleMail::Server::authMethod': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(136): note: see previous definition of 'authMethod'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(126): warning C4273: 'SimpleMail::Server::setAuthMethod': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(141): note: see previous definition of 'setAuthMethod'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(132): warning C4273: 'SimpleMail::Server::sendMail': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(154): note: see previous definition of 'sendMail'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(150): warning C4273: 'SimpleMail::Server::queueSize': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(161): note: see previous definition of 'queueSize'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(156): warning C4273: 'SimpleMail::Server::connectToServer': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(168): note: see previous definition of 'connectToServer'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(184): warning C4273: 'SimpleMail::Server::ignoreSslErrors': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(174): note: see previous definition of 'ignoreSslErrors'
2>D:\Dev\Cutelyst\simple-mail-master\src\server.cpp(193): warning C4273: 'SimpleMail::Server::ignoreSslErrors': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(180): note: see previous definition of 'ignoreSslErrors'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_server.cpp(126): warning C4273: 'SimpleMail::Server::qt_static_metacall': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(31): note: see previous definition of 'qt_static_metacall'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_server.cpp(154): warning C4273: 'staticMetaObject': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(31): note: see previous definition of 'public: static QMetaObject const SimpleMail::Server::staticMetaObject'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_server.cpp(154): error C2491: 'SimpleMail::Server::staticMetaObject': definition of dllimport static data member not allowed
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_server.cpp(165): warning C4273: 'SimpleMail::Server::metaObject': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(31): note: see previous definition of 'metaObject'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_server.cpp(170): warning C4273: 'SimpleMail::Server::qt_metacast': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(31): note: see previous definition of 'qt_metacast'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_server.cpp(178): warning C4273: 'SimpleMail::Server::qt_metacall': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(31): note: see previous definition of 'qt_metacall'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_server.cpp(196): warning C4273: 'SimpleMail::Server::smtpError': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(183): note: see previous definition of 'smtpError'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_server.cpp(203): warning C4273: 'SimpleMail::Server::sslErrors': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\server.h(184): note: see previous definition of 'sslErrors'
2>serverreply.cpp
2>D:\Dev\Cutelyst\simple-mail-master\src\serverreply.cpp(21): warning C4273: 'SimpleMail::ServerReply::ServerReply': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(31): note: see previous definition of '{ctor}'
2>D:\Dev\Cutelyst\simple-mail-master\src\serverreply.cpp(28): warning C4273: 'SimpleMail::ServerReply::~ServerReply': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(32): note: see previous definition of '{dtor}'
2>D:\Dev\Cutelyst\simple-mail-master\src\serverreply.cpp(33): warning C4273: 'SimpleMail::ServerReply::error': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(34): note: see previous definition of 'error'
2>D:\Dev\Cutelyst\simple-mail-master\src\serverreply.cpp(39): warning C4273: 'SimpleMail::ServerReply::responseCode': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(36): note: see previous definition of 'responseCode'
2>D:\Dev\Cutelyst\simple-mail-master\src\serverreply.cpp(45): warning C4273: 'SimpleMail::ServerReply::responseText': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(37): note: see previous definition of 'responseText'
2>D:\Dev\Cutelyst\simple-mail-master\src\serverreply.cpp(51): warning C4273: 'SimpleMail::ServerReply::finish': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(43): note: see previous definition of 'finish'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_serverreply.cpp(67): warning C4273: 'SimpleMail::ServerReply::qt_static_metacall': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(28): note: see previous definition of 'qt_static_metacall'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_serverreply.cpp(88): warning C4273: 'staticMetaObject': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(28): note: see previous definition of 'public: static QMetaObject const SimpleMail::ServerReply::staticMetaObject'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_serverreply.cpp(88): error C2491: 'SimpleMail::ServerReply::staticMetaObject': definition of dllimport static data member not allowed
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_serverreply.cpp(99): warning C4273: 'SimpleMail::ServerReply::metaObject': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(28): note: see previous definition of 'metaObject'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_serverreply.cpp(104): warning C4273: 'SimpleMail::ServerReply::qt_metacast': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(28): note: see previous definition of 'qt_metacast'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_serverreply.cpp(112): warning C4273: 'SimpleMail::ServerReply::qt_metacall': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(28): note: see previous definition of 'qt_metacall'
2>D:\Dev\Cutelyst\simple-mail-master\build\src\SimpleMail2Qt5_autogen\include_Release\moc_serverreply.cpp(130): warning C4273: 'SimpleMail::ServerReply::finished': inconsistent dll linkage
2>d:\dev\cutelyst\simple-mail-master\src\serverreply.h(40): note: see previous definition of 'finished'
2>Generating Code...
2>Done building project "SimpleMail2Qt5.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Demo1 - Connection failed "TLS initialization failed"

I'm testing the demo1 example using QtCreator and trying to send an email using my gmail account.

When I run the example, I get the following error:

simplemail.sender: Sending MAIL 0x1bcc88f6ad0
simplemail.sender: Processing state 1
simplemail.sender: Connecting to host encrypted "smtp.gmail.com" 465
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
simplemail.sender: Connection failed "TLS initialization failed"
"TLS initialization failed"

I've made sure to copy the libeay32.dll and ssleay32.dll files to the debug directory containing my executable but it seems like Open SSL isn't the issue here.

Has anyone experienced similar?

compile error in Qt 5.15.1

I get compile error in sender.cpp & server.cpp

../rcs/thirdparty/simple-mail/src/sender.cpp:148:24: error: static_cast from 'QAbstractSocket::SocketError (QAbstractSocket::)() const' to 'void (QTcpSocket::)(QTcpSocket::SocketError)' is not allowed
connect(d->socket, static_cast<void(QTcpSocket::)(QTcpSocket::SocketError)>(&QTcpSocket::error),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../rcs/thirdparty/simple-mail/src/server.cpp:237:24: error: static_cast from 'QAbstractSocket::SocketError (QAbstractSocket::
)() const' to 'void (QTcpSocket::)(QTcpSocket::SocketError)' is not allowed
q->connect(socket, static_cast<void(QTcpSocket::
)(QTcpSocket::SocketError)>(&QTcpSocket::error),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Update the manual/readme and/or pro file

Hallo,

compiling under Linux was easy. It compiled the libary and all examples very nicely just by 2 commands. Maybe add them into the readme:
cmake CMakeLists.txt
make

But i am not clever enough to do that also with Windows. I tried with gcc/mingw, but cmake doesn't run with it.
I tried mvs. then "cmake CMakeLists.txt" works fine, but not make. i also tried nmake.

Maybe someone can write a hint into the readme how to do it with Windows and MacOS?
Or maybe even better: Someone can add a .pro file, so we can use qmake independently on every os with all compilers very easy. maybe at least for the library.

Thank you!

Program crashes when destructing "SimpleMail::MimeMessage" after calling "SimpleMail::MimeMessage::addPart"

I have the following 3 lines in a function:

SimpleMail::MimeText text;
SimpleMail::MimeMessage message;
message.addPart(&text);

When the function exists, the program crashes as soon as it gets to the destruction of SimpleMail::MimeText.
If I remove the line message.addPart(&text);, it works "fine".

I tried using the (blocking) code from the readme, and the demos. But both have the same problem.

This is the error I'm getting:

*** Error in `[Project path]': double free or corruption (out): 0x00007fffb0eff300 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7f57002117f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8038a)[0x7f570021a38a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f570021e58c]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(_ZN10SimpleMail8MimeTextD0Ev+0x24)[0x7f570126d47c]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(+0x13f19)[0x7f5701269f19]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(+0x13bf8)[0x7f5701269bf8]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(+0x13554)[0x7f5701269554]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(+0x135a0)[0x7f57012695a0]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(+0x15f4b)[0x7f570126bf4b]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(_ZN10SimpleMail8MimePartD1Ev+0x2e)[0x7f570126a3c2]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(_ZN10SimpleMail13MimeMultiPartD1Ev+0x2a)[0x7f57012691b8]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(_ZN10SimpleMail13MimeMultiPartD0Ev+0x18)[0x7f57012691e8]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(+0xeaac)[0x7f5701264aac]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(+0x102af)[0x7f57012662af]
/usr/lib/x86_64-linux-gnu/libSimpleMail2Qt5.so.0(_ZN10SimpleMail11MimeMessageD1Ev+0x2e)[0x7f5701263516]
[Project path][0x4040dc]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f57001ba840]
[Project path][0x402399]
...

(There's a section about Memory maps, it's very long, so I'm not sure if I should include it yet)

I'm using QT 5.11.1, Ubuntu 16.04, and GCC 5.4.0

Blocking code crashes after code block finishes

I am running Qt Created based on Qt 5.15.2. The blocking code crashes after the code block completes. The email sends successfully. I borrowed code from the example and modified it. Application output is Critical error detected c0000374. Here is the backtrace:

backtrace cl

Thanks!

Mutliple mime attechments of the same type not sending

Is there any reason that Multiple mime attachments of the same type (in this case text/html) would not work in simple-mail or due to some RFC spec detail? I see the example with multiple images in Demo4, and I understand that that a common email mode is to have a text attachment and an html attachment, with the client then showing one or the other. But are we not allowed to append N MimeHtml objects along with any other arbitrary content?

When I have more than one html part, then 2nd one onwards is never shown. I have managed to get a workaround to go by creating a single master html instance and including all other content within that. But in this application different parts of content come from different parts of the app and are less easily merged (and from another thread, we would have to keep the unique content created around at a memory cost). After a long day I am not sure about my code not being at fault, but is there any reason one could not have, say, five separate html attachments in a sequence in the email?

Caching mime attachments

This is "how to best do it" question.

We will be running in a separate thread (async) and sending periodic reports to 200~500 users that contains PNG files as mime attachments. The same image (file) may get sent to multiple recipients along with recipient-unique content. But at any given time, one or more of these might have issues with mail delivery to the remote SMTP machine. So we have to make some provisions to re-try failed messages and to keep the shared PNG file around until this is accomplished or declared a failure (several hours?). We envision a Qlist of pending messages that is processed by the thread. [Keeping the file as an inline byte array copy for each message would consume a ton of memory, a concern]

I presume we cannot 'share' a single mime attachment instance, if that right? If so we end up with a unique message structure for each recipient, each with one of more mime attachments, including the one pointing to the shared PNG file. And once these are sent, the program can delete all but the PNG itself. We will have to come up with some sort of reference counting system, or perhaps loop over the pending messages and examining the QList< MimePart* > for a match, to determine when the finial message is away and the PNG file can safely be deleted. If we could share the mime attachment instance, I presume we could then search it it being used. And we will have to remove the file delete call in the mimeFile distructor.

[Aside, a few documentation words on how the memory clean up process works after the message has been sent would be helpful.]

I presume we will have to use mimeFile.cpp and not mimeinline.cpp due to memory issues, but is that also a correct presumption for this use? Or is the in-line variant just intended for use where a pointer to the data is at hand? But I remain confused as it look like mimeFile.cpp is just reading the file content into a QByteArray when used (hence the memory concern).

Any architectural suggestions on how to approach this?

simple-mail vs SmtpClient-for-Qt

Can we get a short summary of how cutelyst / simple-mail is related to the older project bluetiger9 / SmtpClient-for-Qt and/or any other primary sources used?
Trying the get our legal folks satisfied about the code ownership and its history.

Releasing 2.0.1

I'm about to package simple-mail for msys2, and i hit the build issue which is already fixed by ff84c2d. Would it be possible to make a point release with this fix, so i can avoid patching at downstream?

Attachments

How to attach attachments to the email being sent?

Failed to send mail! "Response timed out" after 1ms

While executing demo3
Looks like for some reason the timeout is very aggressive.
I only set the login detail.

On the server (exim 4.88) the log only gives

SSL_write: (from [37.x.y.z]) syscall: Broken pipe

I will try to give a look.

Attachment file with non-ASCII characters in name breaks mail header

If the filename of an attached file contains non-ASCII characters (I tested with German umlauts äöü), the file is encoded in Base64, but the mail header is missing the field "Content-Transfer-Encoding: base64" for the attachment, so the receiver can only view the scrambled Base64 content. Manually setting the encoding of the attachment does not help.

Under normal circumstances, MimeAttachment(QFile *) works fine, the attachment is automatically encoded in Base64 and the mail header is correct.

The code I'm using for sending the mail (simplified):

Sender smtp(smtpServer, 465, Sender::SslConnection);
smtp.setUser(smtpUser);
smtp.setPassword(password);

EmailAddress from(senderAddress, senderName);
EmailAddress to(receiverAddress, receiverName)ö

MimeMessage message;
message.setSender(from);
message.addTo(to);
message.setSubject(subject);

MimeText *text = new MimeText(bodyText);
message.addPart(text);

MimeAttachment *attachment = new MimeAttachment(new QFile(entry.attachmentFile));

// added for testing
attachment->setEncoding(MimeAttachment::Base64);

message.addPart(attachment);

smtp.sendMail(message);

I took a quick look at the library itself, and it seems that at least in the MimePart::write function, the header field is set correctly. Not really sure where to go from here.

Compile error

/usr/lib/x86_64-linux-gnu/qt5/bin/uic: symbol lookup error: /usr/lib/x86_64-linux-gnu/qt5/bin/uic: undefined symbol: qt_qhash_seed

Async code does nothing

I am running Qt Created based on Qt 5.15.2. I borrowed the async code from the example and of course catered it to my situation but nothing happens with no error messages. The following code produces no output regardless of how long I wait:

SimpleMail::ServerReply *reply = server->sendMail(mimeMessage);
        QObject::connect(reply, &SimpleMail::ServerReply::finished, [reply] {
            qDebug() << "Email finished" << reply->error() << reply->responseText();
            reply->deleteLater();// Don't forget to delete it
        });

The blocking code with the same settings works fine.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.