advotracker: reorganize the project using a crate based structure
* advotracker: the framework project * crate/advotrackerdb: implementation of the database backend * crate/advotrackerd: implementation of the backend (daemon) * crate/adovtracker: implementaton of the application (CLI and GUI) Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
40
crates/advotracker_client/examples/email_test.rs
Normal file
40
crates/advotracker_client/examples/email_test.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
use lettre::{
|
||||
transport::smtp::authentication::Credentials,
|
||||
Message, SmtpTransport, Transport,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let email = Message::builder()
|
||||
.from("Info <info@networkx.de>".parse().unwrap())
|
||||
.reply_to("Support <support@networkx.de>".parse().unwrap())
|
||||
.to("Ralf Zerres <ralf.zerres@networkx.de>".parse().unwrap())
|
||||
.subject("Eine advotracker eMail")
|
||||
.body("Eine neue advotracker eMail!".to_string())
|
||||
.unwrap();
|
||||
|
||||
// Create credential for remote authentication (username, password)
|
||||
//let creds = Credentials::new("ralf.zerres@networkx.de".to_string(), "dekifjgh".to_string());
|
||||
let creds = Credentials::new("ralf.zerres.de@gmail.com".to_string(), "20jacara03".to_string());
|
||||
|
||||
// Open a remote connection to relay server
|
||||
//let mailer = SmtpTransport::relay("nwxex.networkx.de")
|
||||
let mailer = SmtpTransport::relay("smtp.gmail.com")
|
||||
.unwrap()
|
||||
.credentials(creds)
|
||||
.build();
|
||||
|
||||
// Open a remote connection to gmail using STARTTLS
|
||||
// let mailer = SmtpTransport::starttls_relay("nwxex.networkx.de")
|
||||
// .unwrap()
|
||||
// .credentials(creds)
|
||||
// .build();
|
||||
|
||||
// Open a local connection on port 25
|
||||
//let mailer = SmtpTransport::unencrypted_localhost();
|
||||
|
||||
// Send the email
|
||||
match mailer.send(&email) {
|
||||
Ok(_) => println!("Email sent successfully!"),
|
||||
Err(e) => panic!("Could not send email: {:?}", e),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user