async-email / async-smtp

Apache License 2.0
59 stars 12 forks source link

How to add a title in a message???? #39

Closed her0mx closed 1 year ago

her0mx commented 3 years ago

Hello I am trie to ad a title because i recived the next error message:

Could not send email: Err(Io(Custom { kind: Other, error: "incomplete" }))

thanks

her0mx commented 3 years ago
async_std::task::block_on(async move {
            let email = SendableEmail::new(
                Envelope::new(
                    Some(match EmailAddress::new(self.from.to_string()) {
                        Ok(email) => email,
                        Err(err) => {
                            eprintln!("the email have a error format {}: {:?}", self.from, err);
                            return;
                        }
                    }),
                    vec![EmailAddress::new(self.to.to_string()).unwrap()],
                )
                .unwrap(),
                "id".to_string(),
                "From: some@some.com\r\n\
                 Subjetc: Hola que tal como te va\r\n
                 Content-Type: text/plain\r\n\
                 \r\n\
                 Hello example".to_string().into_bytes()

i trie some like this but don't work! some@some.com is a example!

ArunGust commented 3 years ago

same issue.

shin0602 commented 2 years ago

@her0mx There is a typo in your code. Subjetc -> Subject

I do this.

 format!("Subject: {}\r\nContent-Type: text/plain\r\n\r\n{}", subject, body)
link2xt commented 1 year ago

Library is not responsible for message construction. As answered already, the message needs a proper Subject: header.