bluetiger9 / SmtpClient-for-Qt

An SMTP Client writen in C++ for Qt. Allows applications to send emails (MIME with text, html, attachments, inline files, etc.) via SMTP. Supports SSL and SMTP authentication.
https://github.com/bluetiger9/SmtpClient-for-Qt/wiki
GNU Lesser General Public License v2.1
449 stars 226 forks source link

Sending E-Mail without prior authentication #127

Closed PidsoEST closed 1 year ago

PidsoEST commented 1 year ago

Is it possible to send a mail through an smtp server that does not require authentication? Could you provide an example on how this could be accomplished with this library?

Thanks! Best Regards,

attila-tokes commented 1 year ago

Hi @PidsoEST,

Just skip the .login() and .waitForAuthenticated() steps:

    smtp.login("your_email_address@host.com", "your_password");
    if (!smtp.waitForAuthenticated()) {
        qDebug() << "Failed to login!";
        return -2;
    }

I think it should work.

Thanks!

PidsoEST commented 1 year ago

@attila-tokes Hi! Thanks for your quick reply!

Hmm... I tried applying your suggestions to the demo1 code but I do not receive any mails, even upon double-checking the server IP and port as well as receiver address. The program though seems to run through. I will try to debug it a little to see if something aborts silently somewhere.

If you have any ideas how to get it to work, I'd be glad!

Best Regards,