Struct email::account::config::AccountConfig
source · pub struct AccountConfig {Show 20 fields
pub name: String,
pub email: String,
pub display_name: Option<String>,
pub signature_delim: Option<String>,
pub signature: Option<String>,
pub downloads_dir: Option<PathBuf>,
pub folder_listing_page_size: Option<usize>,
pub folder_aliases: HashMap<String, String>,
pub email_listing_page_size: Option<usize>,
pub email_listing_datetime_fmt: Option<String>,
pub email_listing_datetime_local_tz: Option<bool>,
pub email_reading_headers: Option<Vec<String>>,
pub email_reading_format: EmailTextPlainFormat,
pub email_writing_headers: Option<Vec<String>>,
pub email_sending_save_copy: Option<bool>,
pub email_hooks: EmailHooks,
pub sync: bool,
pub sync_dir: Option<PathBuf>,
pub sync_folders_strategy: FolderSyncStrategy,
pub pgp: Option<PgpConfig>,
}Expand description
The user’s account configuration.
It represents everything that the user can customize for a given account. It is the main configuration used by all other modules. Usually, it serves as a reference for building config file structure.
Fields§
§name: StringThe name of the user account. It serves as an unique identifier for a given configuration.
email: StringThe email address of the user account.
display_name: Option<String>The display name of the user. It usually corresponds to the full name of the user.
signature_delim: Option<String>The email signature delimiter of the user signature. Defaults
to -- \n.
signature: Option<String>Represents the email signature of the user. It can be either a
path to a file (usually ~/.signature) or a raw string.
downloads_dir: Option<PathBuf>Represents the downloads directory. It is used for downloading attachments.
folder_listing_page_size: Option<usize>Represents the page size when listing folders. A page size of 0 disables the pagination and shows all available folders.
folder_aliases: HashMap<String, String>Represents the folder aliases hash map. There is 4 special aliases:
inbox: main folder containing incoming emailsdraft(s): folder containing draft emailssent: folder containing emails senttrash: folder containing trashed emails
email_listing_page_size: Option<usize>Represents the page size when listing envelopes. A page size of 0 disables the pagination and shows all available envelopes.
email_listing_datetime_fmt: Option<String>Custom format for displaying envelopes date. See
chrono::format::strftime for supported formats. Defaults
to %F %R%:z.
email_listing_datetime_local_tz: Option<bool>If true, transform envelopes date timezone into the user’s
local one. For example, if the user’s local timezone is UTC,
the envelope date 2023-06-15T09:00:00+02:00 becomes
2023-06-15T07:00:00-00:00.
email_reading_headers: Option<Vec<String>>Represents headers visible at the top of email messages when reading them.
email_reading_format: EmailTextPlainFormatRepresents the text/plain format as defined in the RFC 2646.
email_writing_headers: Option<Vec<String>>Represents headers visible at the top of emails when writing them (new/reply/forward).
email_sending_save_copy: Option<bool>Should save a copy of the email being sent in the sent
folder. The sent folder can be customized using
folder_aliases. Knowing that 1) saving an email is done by
the Backend, 2) sending an email is done by
the Sender, and 3) both have no relation
together, it is the library user’s responsibility to check
this option and to save the copy of the sent email.
AccountConfig {
folder_aliases: HashMap::from_iter([("sent", "MyCustomSent")]),
email_sending_save_copy: true,
..Default::default()
};email_hooks: EmailHooksRepresents the email hooks.
sync: boolEnables the synchronization of this account with a local Maildir backend.
sync_dir: Option<PathBuf>Custom root directory where the Maildir cache is
saved. Defaults to $XDG_DATA_HOME/himalaya/<account-name>.
sync_folders_strategy: FolderSyncStrategyRepresents the synchronization strategy to use for folders.
pgp: Option<PgpConfig>The configuration related to PGP encryption.
Implementations§
source§impl AccountConfig
impl AccountConfig
sourcepub fn from(&self) -> Address<'_>
pub fn from(&self) -> Address<'_>
Build a mail_builder::headers::address from a user account
configuration. This is mostly used for building the From
header by message builders.
sourcepub fn downloads_dir(&self) -> PathBuf
pub fn downloads_dir(&self) -> PathBuf
Expand the downloads directory path. Falls back to temporary directory.
sourcepub fn download_fpath(&self, fname: impl AsRef<str>) -> Result<PathBuf>
pub fn download_fpath(&self, fname: impl AsRef<str>) -> Result<PathBuf>
Wrapper around downloads_dir() and rename_file_if_duplicate().
sourcepub fn find_folder_alias(&self, folder: &str) -> Result<Option<String>>
pub fn find_folder_alias(&self, folder: &str) -> Result<Option<String>>
Return the alias of the given folder if defined, otherwise return None.
sourcepub fn get_folder_alias(&self, folder: &str) -> Result<String>
pub fn get_folder_alias(&self, folder: &str) -> Result<String>
Return the alias of the given folder if defined, otherwise return the folder itself. Then expand shell variables.
sourcepub fn inbox_folder_alias(&self) -> Result<String>
pub fn inbox_folder_alias(&self) -> Result<String>
Return the inbox folder alias.
sourcepub fn drafts_folder_alias(&self) -> Result<String>
pub fn drafts_folder_alias(&self) -> Result<String>
Return the drafts folder alias.
sourcepub fn sent_folder_alias(&self) -> Result<String>
pub fn sent_folder_alias(&self) -> Result<String>
Return the sent folder alias.
sourcepub fn trash_folder_alias(&self) -> Result<String>
pub fn trash_folder_alias(&self) -> Result<String>
Return the trash folder alias.
sourcepub fn email_listing_page_size(&self) -> usize
pub fn email_listing_page_size(&self) -> usize
Return the email listing page size if defined, otherwise return the default one.
sourcepub fn email_reading_headers(&self) -> Vec<String>
pub fn email_reading_headers(&self) -> Vec<String>
Return the email reading headers if defined, otherwise return the default ones.
sourcepub fn email_writing_headers(&self) -> Vec<String>
pub fn email_writing_headers(&self) -> Vec<String>
Return the email writing headers if defined, otherwise return the default ones.
sourcepub fn signature(&self) -> Result<Option<String>>
pub fn signature(&self) -> Result<Option<String>>
Return the full signature, including the delimiter.
sourcepub fn sync_dir_exists(&self) -> bool
pub fn sync_dir_exists(&self) -> bool
Return true if the sync directory already exists.
sourcepub fn sync(&self) -> bool
pub fn sync(&self) -> bool
Return true if the sync directory already exists and if the
sync feature is enabled.
sourcepub fn sync_dir(&self) -> Result<PathBuf>
pub fn sync_dir(&self) -> Result<PathBuf>
Return the sync directory if exist, otherwise create it.
sourcepub fn sync_db_builder(&self) -> Result<Connection>
pub fn sync_db_builder(&self) -> Result<Connection>
Open a SQLite connection to the synchronization database.
sourcepub fn generate_tpl_interpreter(&self) -> MimeInterpreterBuilder
pub fn generate_tpl_interpreter(&self) -> MimeInterpreterBuilder
Generate a template interpreter with prefilled options from the current user account configuration.
sourcepub fn email_listing_datetime_fmt(&self) -> String
pub fn email_listing_datetime_fmt(&self) -> String
Return the email listing datetime format, otherwise return the default one.
sourcepub fn email_listing_datetime_local_tz(&self) -> bool
pub fn email_listing_datetime_local_tz(&self) -> bool
Return the email listing datetime local timezone option, otherwise return the default one.
Trait Implementations§
source§impl Clone for AccountConfig
impl Clone for AccountConfig
source§fn clone(&self) -> AccountConfig
fn clone(&self) -> AccountConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for AccountConfig
impl Debug for AccountConfig
source§impl Default for AccountConfig
impl Default for AccountConfig
source§fn default() -> AccountConfig
fn default() -> AccountConfig
source§impl PartialEq for AccountConfig
impl PartialEq for AccountConfig
source§fn eq(&self, other: &AccountConfig) -> bool
fn eq(&self, other: &AccountConfig) -> bool
self and other values to be equal, and is used
by ==.impl Eq for AccountConfig
impl StructuralEq for AccountConfig
impl StructuralPartialEq for AccountConfig
Auto Trait Implementations§
impl RefUnwindSafe for AccountConfig
impl Send for AccountConfig
impl Sync for AccountConfig
impl Unpin for AccountConfig
impl UnwindSafe for AccountConfig
Blanket Implementations§
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].