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
452 stars 227 forks source link

Using smtp withaut Authentication #90

Closed joejond closed 5 years ago

joejond commented 5 years ago

Hi, Im tryng using this library to send email to port 25 and without using Username and Password. But after compile always return "login Failed"

SmtpClient smtp("mail.host.com", 25, SmtpClient::TcpConnection); smtp.setUser(""); smtp.setPassword("");

please give advice

bluetiger9 commented 5 years ago

I think, you could just skip the login step:

    if (!smtp.connectToHost()) {
        qDebug() << "Failed to connect to host!" << endl;
        return -1;
    }

    // if (!smtp.login()) {
    //    qDebug() << "Failed to login!" << endl;
    //    return -2;
    // }

    if (!smtp.sendMail(message)) {
        qDebug() << "Failed to send mail!" << endl;
        return -3;
    }

(https://github.com/bluetiger9/SmtpClient-for-Qt/blob/v1.1/demos/demo1/demo1.cpp)

joejond commented 5 years ago

hi @bluetiger9 thanks for advice. yes it solve right now. case close.