Closed niksadovsk closed 1 year ago
Hi @niksadovsk! This sounds like a Windows service connectivity problem...
I have no experience with Windows services, but threw your question to Chat GPT, and among others it gave me these suggestions:
Permissions and Privileges: Windows services typically run under a different user context with different privileges than when you run an executable manually. Ensure that the user context in which the service is running has the necessary permissions to access the network and establish outbound connections. It might also need permission to access the files you're trying to attach.
Network Access: Make sure the Windows service has network access and isn't restricted by any firewall settings. Services may have different network access permissions compared to a regular user session.
So, I would suggest checking these first. If that does not helps, try creating a simple application that just opens a TCP / SSL connection to the server. If that works it means you a some problem with the library (maybe missing DLL-s), otherwise it indeed a connectivity issue.
Hi! I am trying to send an attachment using SmtpClient for Qt. My code works in Qt (I am using mingw qt 6.1.3, QtCreator 5.0.0 based on qt 5.15.2), it also works when i start it like .exe, but when i start it like a windows service (Windows 7) it says: Failed to connect to host! Can you help me, please, to solve this problem? My code:
MimeMessage message;
EmailAddress sender(Email_sender, Name_sender);
message.setSender(sender);
EmailAddress to(Email_Recipient, Name_Recipient);
message.addRecipient(to);
message.setSubject("IFKT");
SmtpClient smtp(server, 465, SmtpClient::SslConnection);
smtp.connectToHost();
if (!smtp.waitForReadyConnected(30000)){
text.append(" Failed to connect to host! ");
}