diff --git a/src/mail.rs b/src/mail.rs index c1995b8..f4ec21d 100644 --- a/src/mail.rs +++ b/src/mail.rs @@ -30,39 +30,46 @@ pub fn send_notification( Goodbye"; } else { body += &format!( - "Unsubscribe from this PR", + "Unsubscribe from this PR\n", + &CONFIG.url, + encode(recipient) + ); + body += &format!( + "Unsubscribe from all PRs", &CONFIG.url, encode(recipient) ); } - let sending_address = env::var("PR_TRACKER_MAIL_ADDRESS")?; + let sending_address = env::var("PR_TRACKER_MAIL_ADDRESS").unwrap(); let sending_user = match env::var("PR_TRACKER_MAIL_USER") { Ok(address) => address, _ => sending_address.clone(), }; - let sending_passwd = env::var("PR_TRACKER_MAIL_PASSWD")?; + let sending_passwd = env::var("PR_TRACKER_MAIL_PASSWD").unwrap(); - let sending_server = env::var("PR_TRACKER_MAIL_SERVER")?; + let sending_server = env::var("PR_TRACKER_MAIL_SERVER").unwrap(); let email = Message::builder() - .from(format!("PR-Tracker <{}>", sending_address).parse()?) - .to(Mailbox::new(None, recipient.parse()?)) + .from(format!("PR-Tracker <{}>", sending_address).parse().unwrap()) + .to(Mailbox::new(None, recipient.parse().unwrap())) .subject(format!( "PR-tracker: {pr_number}: {pr_title} has reached {:?}", branches )) .header(ContentType::TEXT_PLAIN) - .body(body)?; + .body(body) + .unwrap(); let creds = Credentials::new(sending_user.to_string(), sending_passwd.to_string()); // Open a remote connection to gmail - let mailer = SmtpTransport::relay(&sending_server)? + let mailer = SmtpTransport::relay(&sending_server) + .unwrap() .credentials(creds) .build(); // Send the email - mailer.send(&email)?; + mailer.send(&email).unwrap(); println!("Email sent successfully!"); Ok(())