Fixed an issue with string conversion of the client addresses.
This commit is contained in:
parent
66ca846ebb
commit
e7b0925a64
2 changed files with 13 additions and 7 deletions
14
src/main.rs
14
src/main.rs
|
@ -84,14 +84,18 @@ fn main() {
|
||||||
loop {
|
loop {
|
||||||
match rx.recv() {
|
match rx.recv() {
|
||||||
Ok(data) => {
|
Ok(data) => {
|
||||||
|
println!("Sending mail to: {}", data[0]);
|
||||||
let mail = lettre::SendableEmail::new(
|
let mail = lettre::SendableEmail::new(
|
||||||
lettre::Envelope::new(
|
lettre::Envelope::new(
|
||||||
Some("m2m.chaostreff-alzye.de".parse().unwrap()),
|
Some(
|
||||||
vec![data[0].parse().unwrap()]
|
lettre::EmailAddress::new("m2m@chaostreff-alzey.de".to_owned())
|
||||||
|
.unwrap()
|
||||||
|
),
|
||||||
|
vec![
|
||||||
|
lettre::EmailAddress::new(data[0].clone()).unwrap()]
|
||||||
).unwrap(),
|
).unwrap(),
|
||||||
format!("You were mentioned in {} on {}", data[2], data[1])
|
format!("You were mentioned in {} on {}", data[2], data[1]),
|
||||||
.parse().unwrap(),
|
format!("{}: {}", data[3], data[4]).into_bytes()
|
||||||
format!("{}: {}", data[3], data[4]).into()
|
|
||||||
);
|
);
|
||||||
match mailer.send(mail) {
|
match mailer.send(mail) {
|
||||||
Ok(_) => println!("Email sent successfully!"),
|
Ok(_) => println!("Email sent successfully!"),
|
||||||
|
|
|
@ -200,7 +200,9 @@ pub fn handle_server(config: Value, tx: Sender<[String; 5]>)
|
||||||
Some(addr) => {
|
Some(addr) => {
|
||||||
// There must be a better way to do this…
|
// There must be a better way to do this…
|
||||||
let out = [
|
let out = [
|
||||||
addr.to_string(),
|
addr.as_str()
|
||||||
|
.ok_or("Could not parse email address.")?
|
||||||
|
.to_owned(),
|
||||||
server_name.to_owned(),
|
server_name.to_owned(),
|
||||||
d[1].clone(),
|
d[1].clone(),
|
||||||
d[2].clone(),
|
d[2].clone(),
|
||||||
|
|
Loading…
Reference in a new issue