Module ashpd::desktop::email[][src]

Expand description

Compose an email.

Examples

Compose an email

use ashpd::desktop::email::{Email, EmailProxy};
use ashpd::WindowIdentifier;
use std::fs::File;
use std::os::unix::io::AsRawFd;
use zvariant::Fd;

async fn run() -> Result<(), ashpd::Error> {
    let connection = zbus::azync::Connection::new_session().await?;
    let proxy = EmailProxy::new(&connection).await?;
    let file = File::open("/home/bilelmoussaoui/Downloads/adwaita-night.jpg").unwrap();
    proxy
        .compose_email(
            WindowIdentifier::default(),
            Email::new()
                .address("test@gmail.com")
                .subject("email subject")
                .body("the pre-filled email body")
                .attach(Fd::from(file.as_raw_fd())),
        )
        .await?;

    Ok(())
}

Structs

Email

Specified options for a EmailProxy::compose_email request.

EmailProxy

The interface lets sandboxed applications request sending an email.