Send attachment by email
-
The developed program is very simple: it connects to a MySQL database and retrieves some data depending on the user's input.
The program works fine both on my development laptop and on ALL other laptops.
To distribute the program on all other laptops, I created a folder where I put the executable and also all the required DLLs from QT and from the MySQL library.
The executable works fine both on my computer and on the other laptops.Two days ago, I decided to include the SmtpClient-for-Qt library as you suggested in this topic but I need to provide the user to send some information by email.
I integrated the smtp code in my program, I built it and I put the executable in the folder used to redistribute the program together with the SMTPEmail.dll (If I run the executable without this DLL, it gives me the missing DLL error for SMTPEmail.dll and for Qt5Network.dll, so I added them to the folder ).
Now, the executable works fine and correctly send emails IF I run it from the folder ON MY laptop.
The executable opens and runs fine also on all other computers but WHEN the user tries to SEND the email, it gives the error: "CANNOT connect to host".So the program runs correctly on ALL the laptops, but it gives the connection error when the user tries to send email from all other laptops (it works fine only on my development laptop).
At the beginning, I thought about a network error, but all the laptops (included my laptop) are in the same network.
This is the file list for the folder from where I run the program (it's the same both for my laptop and the other ones):
27/05/2021 00:22 <DIR> email 07/03/2021 19:37 <DIR> imageformats 13/07/2017 13:29 4,879,360 libmysql.dll 06/06/2021 21:11 16,996 myapp.res 28/05/2021 22:43 <DIR> pics 07/03/2021 19:37 <DIR> platforms 06/06/2021 23:27 4,460,032 PUMP.exe 17/05/2021 21:54 140,242 pump_db (1).sql 20/05/2021 08:25 218,138 pump_db_20_05_21.sql 11/05/2020 10:46 5,998,712 Qt5Core.dll 11/05/2020 10:47 7,085,176 Qt5Gui.dll 11/05/2020 10:47 1,349,240 Qt5Network.dll 11/05/2020 10:47 208,504 Qt5Sql.dll 11/05/2020 17:05 329,848 Qt5Svg.dll 11/05/2020 10:47 5,516,920 Qt5Widgets.dll 05/06/2021 00:21 74,240 SMTPEmail.dll 07/03/2021 19:37 <DIR> sqldrivers 07/03/2021 19:37 <DIR> styles
-
Like @JonB and I said in Send attachment by email:
Does the target have the OpenSSL libraries/support installed, which I understand is required for Qt SSL support?
Your open SSL DLLs are missing from the installation folder, they are apparently part of your system path (on your development pc) but you can't guarantee that for all systems-> The reason why it fails on other machines.
Provide them. -
I'm going to check this even if I receive no errors about these missing DDLs when I run the program on the other systems.
Shouldn't I receive an error as soon as I try to run the program? -
@Marcus-Barnet said in Send attachment by email:
I'm going to check this even if I receive no errors about these missing DDLs when I run the program on the other systems.
Shouldn't I receive an error as soon as I try to run the program?no, in this case its a silent fail,
silent, in so much as, you should (technically) a get a console output about a failed loading
-
@Marcus-Barnet said in Send attachment by email:
Shouldn't I receive an error as soon as I try to run the program?
Not if the OpenSSL stuff is dynamically loaded (e.g. when the first call is made to send using encryption) instead of statically linked. Which may be what @J-Hilk is indicating is the case.
-
Thank you, guys!
Now, it works fine! I copied both files to the folder and the program runs fine on all laptops.
-
@Marcus-Barnet Hello, Can I ask you something about the topic?
-
@Long-Vu-Ngoc That user likely won't be around. Just ask your question. Create a new topic probably.
-
-
@Long-Vu-Ngoc I know, I saw it. Stick to that, you won't get any more help from here.