skerkour / kerkour.com

(Ab)using technology for fun & profit. Programming, Hacking & Entrepreneurship @ https://kerkour.com

Home Page:https://kerkour.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to resolve multiple types in email sending example

vbmade2000 opened this issue · comments

Tried to compile an example that shows email sending. Got this error.

error[E0433]: failed to resolve: could not find `smtp` in `transport`
 --> src/main.rs:2:17
  |
2 |      transport::smtp::authentication::Credentials, AsyncSmtpTransport, AsyncTransport, Message,
  |                 ^^^^ could not find `smtp` in `transport`

error[E0432]: unresolved imports `lettre::AsyncSmtpTransport`, `lettre::AsyncTransport`, `lettre::Tokio1Executor`
 --> src/main.rs:2:52
  |
2 |      transport::smtp::authentication::Credentials, AsyncSmtpTransport, AsyncTransport, Message,
  |                                                    ^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^ no `AsyncTransport` in the root
  |                                                    |
  |                                                    no `AsyncSmtpTransport` in the root
3 |      Tokio1Executor,
  |      ^^^^^^^^^^^^^^ no `Tokio1Executor` in the root

error[E0433]: failed to resolve: use of undeclared type `Credentials`
 --> src/main.rs:9:10
  |
9 |          Credentials::new("smtp_username".to_string(), "smtp_password".to_string());
  |          ^^^^^^^^^^^ use of undeclared type `Credentials`

Looks like you have to enable tokio1 and smtp-transport features of lettre crate.

Yes, You can see here the features to enable :)

# lettre = { version = "0.10.0-beta.2", default-features = false, features = ["smtp-transport", "tokio1-rustls-tls", "hostname", "r2d2", "builder"] }