diff --git a/src/main.rs b/src/main.rs
index 5c4c72e..38128a0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,6 +14,8 @@ struct AppState {
     listen: String,
     receiver: String,
     jid: String,
+    supports_password_file: bool,
+    password_file: String,
     password: String,
 }
 
@@ -23,6 +25,8 @@ impl AppState{
             listen: String::from("[::]:9199"),
             receiver: String::from(""),
             jid: String::from(""),
+            supports_password_file: false,
+            password_file: String::from(""),
             password: String::from(""),
         }
     }
@@ -93,6 +97,7 @@ async fn main() {
     if password_file == String::from("") {
         println!("--password-file not specified");
     } else {
+        app_state.password_file = password_file.clone();
         app_state.password = std::fs::read_to_string(password_file).unwrap().trim().to_string();
     }
 
@@ -101,6 +106,34 @@ async fn main() {
         std::process::exit(1);
     }
 
+    let mut command = std::process::Command::new("xmppc");
+    command.arg("--help").stdout(std::process::Stdio::piped());
+
+    let mut child = match command.spawn() {
+        Ok(child) => child,
+        Err(_) => {
+            println!("ERROR: Error starting xmppc");
+            std::process::exit(1)
+        }
+    };
+
+    let status = match child.wait() {
+        Ok(status) => status,
+        Err(_) => {
+            println!("ERROR: Error executing xmppc");
+            std::process::exit(1)
+        }
+    };
+
+    if !status.success() {
+        println!("ERROR: xmppc failed sending message");
+        std::process::exit(1)
+    }
+
+    if std::io::read_to_string(child.stdout.unwrap()).unwrap().contains("--pwd-file") {
+        app_state.supports_password_file = true;
+    }
+
     let mut app = Router::new();
     app = app.route("/alert", post(alert));
 
@@ -216,9 +249,16 @@ async fn alert(State(app_state): State<AppState>, Json(payload): Json<serde_json
     println!("{}", message);
 
     let mut command = std::process::Command::new("xmppc");
-    command.arg("--jid").arg(app_state.jid)
-        .arg("--pwd").arg(app_state.password)
-        .arg("--mode").arg("message")
+    command.arg("--jid").arg(app_state.jid);
+
+    if app_state.supports_password_file {
+        command.arg("--pwd-file").arg(app_state.password_file);
+    }
+    else {
+        command.arg("--pwd").arg(app_state.password);
+    }
+
+    command.arg("--mode").arg("message")
         .arg("chat").arg(app_state.receiver).arg(message);
 
     let mut child = match command.spawn() {