Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Alexis Mousset
@amousset
Could you log a mail transaction in debug (for example with env-logger, like in https://github.com/lettre/lettre/blob/master/lettre/examples/smtp.rs), to see which step timeouts?
rustrust
@rustrust
i switched to a REST api interface to keep the system running, it was too urgent. i might be able to get back to you soon on this.
Karan Savla
@karansavla_gitlab

Hello Everyone, I am trying to send a html message using lettre=0.9. using SendableEmail but, I am not sure how to do. Can some one help

Code :-
let email = SendableEmail::new(
Envelope::new(
Some(EmailAddress::new(smtp_username.to_string()).unwrap()),
vec![EmailAddress::new(to_email.to_string()).unwrap()],
)
.unwrap(),
"Login_Email".to_string(),
format!("<h2>Hi,</h2><div><p>Hello {}</p>", "John").to_string().into_bytes(),
);

But, I am getting empty email

Moritz Bischof
@NyxCode_gitlab
:laughing:
That's exactly why I joined this chat - to ask how to send an html email
Could anyone help with this?
ah, got it!
@karansavla_gitlab
add Content-Type: text/html; to the start of the content of your message
Karan Savla
@karansavla_gitlab
Thanks @NyxCode_gitlab :)
inzanez
@inzanez
Hi
inzanez
@inzanez
I just compiled a small lettre test project (sending an email through a STARTTLS connection) statically against libressl using musl.
This works well as long as the binary lives on my development machine. Once I transfer it into a docker container however, it claims that the certificate cannot be verified. Trusted certs etc. are in the docker container. I just verified this with a Golang SMTP client that uses STARTTLS too. Any idea what's happening here?oO
Eduard Tolosa
@Edu4rdSHL
Hello, I'm trying to use lettre but I just have errors everywhere in the smtp_gmail example.
That example is updated to use the git version?
If yes, I'm having this issue when building from git:
└─ ▶ cargo build
   Compiling lettre v0.10.0-alpha.0 (https://github.com/lettre/lettre#e87f9950)
error[E0428]: the name `Tls` is defined multiple times
  --> /home/sechacklabs/.cargo/git/checkouts/lettre-53652803723a9045/e87f995/src/transport/smtp/client/net.rs:58:5
   |
56 |     Tls(Box<TlsStream<TcpStream>>),
   |     ------------------------------ previous definition of the type `Tls` here
57 |     #[cfg(feature = "rustls-tls")]
58 |     Tls(Box<rustls::StreamOwned<ClientSession, TcpStream>>),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Tls` redefined here
   |
   = note: `Tls` must be defined only once in the type namespace of this enum

error[E0124]: field `connector` is already declared
  --> /home/sechacklabs/.cargo/git/checkouts/lettre-53652803723a9045/e87f995/src/transport/smtp/client/net.rs:28:5
   |
24 |     connector: TlsConnector,
   |     ----------------------- `connector` first declared here
...
28 |     connector: Box<ClientConfig>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field already declared

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0124, E0428.
For more information about an error, try `rustc --explain E0124`.
error: could not compile `lettre`.

To learn more, run the command again with --verbose.
Thanks in advance.
Wojciech Niedźwiedź
@Niedzwiedzw
hey I'm getting a weird error
Err(Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }))
// Send the email
mailer.send(email)?;
it's from here
Alexis Mousset
@amousset
Hi @Niedzwiedzw this looks like a networking error, are you sure you are using the right port to connect to the SMTP server?
Wojciech Niedźwiedź
@Niedzwiedzw
sorry I don't know much about both email protocol and networking :D
I was thinking this just works out of the box, do I need to run a separate server?
Wojciech Niedźwiedź
@Niedzwiedzw
@amousset
Wojciech Niedźwiedź
@Niedzwiedzw
use lettre::{SendableEmail, EmailAddress, Transport, Envelope, SmtpClient};
use lettre_email::EmailBuilder;
use std::path::Path;


static EMAIL_LOGGING_TARGET: &str = "niedzwiedzwo@gmail.com";


pub fn log_email(subject: &str, message: &str) -> Result<(), Box<dyn std::error::Error>> {
    let email = SendableEmail::new(
        Envelope::new(
            Some(EmailAddress::new("logging@aplikacja-alternator.pl".to_string()).unwrap()),
            vec![EmailAddress::new(EMAIL_LOGGING_TARGET.to_string()).unwrap()],
        ).unwrap(),
        "1234124123213".to_string(),
        "Hello world".to_string().into_bytes(),
    );
    println!("email created");
    // Open a local connection on port 25
    let mut mailer = SmtpClient::new_unencrypted_localhost()?
        .transport();
    println!("spawning mailer service");

    // Send the email
    mailer.send(email)?;
    Ok(())
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_sending_email() {
        println!("{:?}", log_email("test123123", "test12312312321").unwrap());
    }
}
Wojciech Niedźwiedź
@Niedzwiedzw
it's pretty much copy&paste from the docs
...
Mehmet ERİBOL
@mehmeteribol_gitlab
hi. when use SmtpClient::new_unencrypted_localhost()?i can send mail to gmail but it goes to spam. I used new_simple method used "mydomain.org" for domain and it says;
Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
Mathijs van Veluw
@BlackDex
Hello, i'm trying to use the latest git revision, but am i correct that it now isn't possible any more to create a custom TlsConnector without using the SmtpTransportBuilder right?
Mathijs van Veluw
@BlackDex
Because, i want to set some custom native-tls options like danger_accept_invalid_hostnames for example
Mathijs van Veluw
@BlackDex
Seems it's not possible at all because of the InnerTlsParameters
Paolo Barbolini
@paolobarbolini
Right @BlackDex. Since we have started planning for lettre 1.0, which will come out after 0.10, we started removing some crates from the public API to avoid having to do a new major release when they update.
But danger_accept_invalid_hostnames is something that makes sense to have. Would you be interested in opening a PR about it?
Paolo Barbolini
@paolobarbolini
We'll also probably want danger_accept_invalid_certs
Mathijs van Veluw
@BlackDex
Lets see if i can create something :). It isn't trivial, but a nice to have. :)
Mathijs van Veluw
@BlackDex
What is the reason that pub has been removed from mod error?
ah wait, it is all up a level in the mod now
Paolo Barbolini
@paolobarbolini
Yup. Having tiny modules is fine, but exposing them makes docs harder to read and imports longer, so it was made private and just re-exported where it made more sense.
Mathijs van Veluw
@BlackDex
@fgadaleta: What kind of messages do you want to receive?
Edoardo Lanzini
@elanzini
hello! I saw that in the 0.9.* version it was possible to attach files to the email. Is there an option to do so in 0.10.*?
Paolo Barbolini
@paolobarbolini
Could you mention it in this issue? lettre/lettre#467 @edoardolanzini
Edoardo Lanzini
@elanzini
thomasmarschall
@thomasmarschall
Hi, I'm having a couple of problems. One, when attempting to use lettre_email to send an attachment, I get a line too long message back from my mail relay, which is hmail. Two, I am trying to use InnerClient<NetworkStream> to send an email, using "emailmessage" to build the message, but I am a little new to rust so I am not sure how to pass the content of the message to the innerclient. Please help, and thanks in advance.
Paolo Barbolini
@paolobarbolini
Unfortunately lettre 0.9 had a few bugs and from memory the one you described might be one of them. Could you try using 0.10.0-alpha.2?
@thomasmarschall
thomasmarschall
@thomasmarschall
that seems to have done the trick, thank you.