Use this (unofficial) client to send emails and SMS text messages using the GOV.UK Notify API in Rust.
Not yet implemented: - Emailing files - Sending physical letters
```rust use govuknotify::NotifyClient; use serdejson::{Map, Value};
async fn mailer() { let apikey = String::from("mytestkey-26785a09-ab16-4eb0-8407-a37497a57506-3d844edf-8d35-48ac-975b-e847b4f122b0"); let notifyclient = NotifyClient::new(apikey); let mut personalisation = Map::new(); let mut personalisationvalues = Map::new(); personalisationvalues.insert("myvar".tostring(), Value::String("my value".tostring())); personalisation.insert("personalisation".tostring(), Value::Object(personalisationvalues)); let emailaddress = String::from("john.doe@example.com"); let templateid = String::from("217a419e-6a7d-482a-9596-718b889dffce");
notify_client.send_email(email_address, template_id, Some(personalisation)).await;
}
async fn texter() { let apikey = String::from("mytestkey-26785a09-ab16-4eb0-8407-a37497a57506-3d844edf-8d35-48ac-975b-e847b4f122b0"); let notifyclient = NotifyClient::new(apikey); let phonenumber = String::from("+447900900123"); let template_id = String::from("217a419e-6a7d-482a-9596-718b889dffce");
notify_client.send_sms(phone_number, template_id, None).await;
} ```