rustdesk-server-pro icon indicating copy to clipboard operation
rustdesk-server-pro copied to clipboard

SMTP Problem

Open Apashh opened this issue 1 year ago • 69 comments

Hello,

I'm on 1.1.10-3 and my email not send.... How change smtp settings or email without access on web console ? Maybe in sqlite ?

Thanks !

Apashh avatar Oct 02 '23 16:10 Apashh

you can not access web console?

rustdesk avatar Oct 03 '23 06:10 rustdesk

Access is ok ! But when it send 2FA Code via e-mail, i have no e-mail recieve.. So i would like to disable 2FA without acess to web console 😉

Apashh avatar Oct 03 '23 09:10 Apashh

Not working for you?

image

rustdesk avatar Oct 03 '23 09:10 rustdesk

I upgraded from version 1.1.9 to version 1.1.10-3. I had SMTP in the old version which worked well. Today, I no longer receive anything. I would like to deactivate 2FA without entering the WEB console. Can we do this via SQLite? or another solution?

Apashh avatar Oct 04 '23 20:10 Apashh

We did have back compatibility test for this, but maybe we missed something.

Yes, please backup all db files first, db.sqlite3 and db.sqlite3-* files first. then you can run sqlite3 db.sqlite3 with below sql. update user set info=json_remove(info, '$.email_verification') where name='test'; please change 'test' to your name.

But in the web console after you logged in, you will still see. You can tick it off and update.

rustdesk avatar Oct 05 '23 03:10 rustdesk

@dignow this is what I worried most, back compatibility. FIX this ASAP. No matter what changes we do, this is the most important thing.

rustdesk avatar Oct 05 '23 03:10 rustdesk

I'm failed to reproduce this issue.

  1. Delete current db.sqlite3.
  2. Checkout 1.1.9.
  3. Create and migrate db.
  4. Run and configure SMTP settings, and "Enable email login verification".
  5. Checkout 1.1.10-3.
  6. Migrate db.
  7. Login.

I can receive the email after Step 7.

@Apashh Which type of email did you want to send?

image

dignow avatar Oct 05 '23 04:10 dignow

Another user also reported this via [email protected]

rustdesk avatar Oct 05 '23 04:10 rustdesk

I've tried 1.1.8 -> 1.1.10-3 and 1.1.9 -> 1.1.10-3. Sending email 2FA code works fine when login.

dignow avatar Oct 05 '23 07:10 dignow

I guess they have different settings which we do not have in our test. Let's wait for their reply.

rustdesk avatar Oct 05 '23 07:10 rustdesk

We did have back compatibility test for this, but maybe we missed something.

Yes, please backup all db files first, db.sqlite3 and db.sqlite3-* files first. then you can run sqlite3 db.sqlite3 with below sql. update user set info=json_remove(info, '$.email_verification') where name='test'; please change 'test' to your name.

But in the web console after you logged in, you will still see. You can tick it off and update.

I made the commands and accessed the console again but 2FA did not work. In the SMTP settings, I validate the settings (I use the same on other applications), the console tells me that everything is good, I enter an email address for tester but I receive nothing (even in spam) .

Apashh avatar Oct 05 '23 11:10 Apashh

@Apashh Thanks for your feedback.

What's the test result message?

1696566797823

dignow avatar Oct 06 '23 04:10 dignow

@Apashh Thanks for your feedback.

What's the test result message?

1696566797823

No message when click on submit and test :

image

Apashh avatar Oct 09 '23 06:10 Apashh

Does ssl0.ovh.net require payment? I'm failed to register the email.

But it's strange that there's no reply. Can you try a wrong password?

https://github.com/rustdesk/rustdesk-server-pro/assets/136106582/3989d272-7d61-45d5-9990-f607f5cc86d0

dignow avatar Oct 09 '23 12:10 dignow

Est-ce ssl0.ovh.netqu'il faut payer ? Je n'ai pas réussi à enregistrer l'e-mail.

Mais c'est étrange qu'il n'y ait pas de réponse. Pouvez-vous essayer un mauvais mot de passe ?

ase.mp4

I have an error :

image

But if password is good, no message appear and no message recieve in inbox

Apashh avatar Oct 09 '23 15:10 Apashh

Have you input the receiver email here? If empty no test email will be sent, only updates will be made.

1696908410266

dignow avatar Oct 10 '23 03:10 dignow

Have you input the receiver email here? If empty no test email will be sent, only updates will be made.

1696908410266

Yep the reciever its not empty :)

Apashh avatar Oct 10 '23 06:10 Apashh

I'm not clear of what you said.

Do you mean the receiver email is not empty, you have set the receiver email and then click "OK"?

If so, can you please run a rust test? Sorry for the inconvenience, but I cannot find out the reason if the message is empty while the receiver email is set.

https://crates.io/crates/lettre

use lettre::message::header::ContentType;
use lettre::transport::smtp::authentication::Credentials;
use lettre::{Message, SmtpTransport, Transport};

fn main() {
    let email = Message::builder()
        .from("NoBody <[email protected]>".parse().unwrap())
        .reply_to("Yuin <[email protected]>".parse().unwrap())
        .to("Hei <[email protected]>".parse().unwrap())
        .subject("Happy new year")
        .header(ContentType::TEXT_PLAIN)
        .body(String::from("Be happy!"))
        .unwrap();

    let creds = Credentials::new("smtp_username".to_owned(), "smtp_password".to_owned());

    let mailer = SmtpTransport::starttls_relay("smtp.gmail.com")
        .unwrap()
        .credentials(creds)
        .port(587)
        .build();

    match mailer.send(&email) {
        Ok(r) => println!(
            "Email sent successfully: {}, {:?}",
            r.code(),
            r.message().collect::<Vec<&str>>()
        ),
        Err(e) => panic!("Could not send email: {:?}", e),
    }
}

dignow avatar Oct 10 '23 06:10 dignow

I'm not clear of what you said.

Do you mean the receiver email is not empty, you have set the receiver email and then click "OK"?

If so, can you please run a rust test? Sorry for the inconvenience, but I cannot find out the reason if the message is empty while the receiver email is set.

https://crates.io/crates/lettre

use lettre::message::header::ContentType;
use lettre::transport::smtp::authentication::Credentials;
use lettre::{Message, SmtpTransport, Transport};

fn main() {
    let email = Message::builder()
        .from("NoBody <[email protected]>".parse().unwrap())
        .reply_to("Yuin <[email protected]>".parse().unwrap())
        .to("Hei <[email protected]>".parse().unwrap())
        .subject("Happy new year")
        .header(ContentType::TEXT_PLAIN)
        .body(String::from("Be happy!"))
        .unwrap();

    let creds = Credentials::new("smtp_username".to_owned(), "smtp_password".to_owned());

    let mailer = SmtpTransport::starttls_relay("smtp.gmail.com")
        .unwrap()
        .credentials(creds)
        .port(587)
        .build();

    match mailer.send(&email) {
        Ok(r) => println!(
            "Email sent successfully: {}, {:?}",
            r.code(),
            r.message().collect::<Vec<&str>>()
        ),
        Err(e) => panic!("Could not send email: {:?}", e),
    }
}

Yep I have set the reciever and click on OK but nothing ... How run rust test ?

Apashh avatar Oct 10 '23 10:10 Apashh

What OS do you use? Can you run my executable file?

I've attached my files here. Please run in the terminal.

If you use linux or macos, please run chmod +x simple_test_<linux|macos> first.

1696941584609

simple_mail_test.zip

This test app uses native-tls.

The test app in https://github.com/rustdesk/rustdesk-server-pro/issues/99#issuecomment-1775326168 uses tokio1-rustls-tls.

dignow avatar Oct 10 '23 12:10 dignow

What OS do you use? Can you run my executable file?

I've attached my files here. Please run in the terminal.

If you use linux or macos, please run chmod +x simple_test_<linux|macos> first.

1696941584609 [simple_mail_test.zip](https://github.com/rustdesk/rustdesk-server-pro/files/12857272/simple_mail_test.zip)

Hello, i have test it and error : image

How add option starttls or ssl option with port 587 or 465 ?

Apashh avatar Oct 12 '23 06:10 Apashh

My command :

./simple_test_linux -f [email protected] -p Password -P 25/587/465 -s ssl0.ovh.net -t [email protected] -u [email protected]

Apashh avatar Oct 12 '23 06:10 Apashh

Add -S will set starttls to be true.

The port is set by -P.

./simple_test_linux -S -P 587 ...

dignow avatar Oct 12 '23 06:10 dignow

Email recieve perfectly with same option of web console

image

Apashh avatar Oct 12 '23 07:10 Apashh

Thanks. I need to double check the code.

dignow avatar Oct 12 '23 07:10 dignow

Have you restarted the server, except for the upgrade?

Can you please try restart the server?

I find a problem that the same email configuration may not trigger the send actions (if initialization fails).

dignow avatar Oct 12 '23 07:10 dignow

hbbr and hbbs restarted, smtp test and same, no mail, no message on webconsole...

Apashh avatar Oct 12 '23 08:10 Apashh

Thanks @Apashh

rustdesk avatar Oct 12 '23 08:10 rustdesk

Can you see that the update operation was successful?

1697102562686

dignow avatar Oct 12 '23 09:10 dignow

@Apashh Can you please try again this test on your machine? Thanks.

~~simple_test_linux_2.zip~~

Use https://github.com/rustdesk/rustdesk-server-pro/issues/99#issuecomment-1775326168 instead.

dignow avatar Oct 12 '23 10:10 dignow