pub struct PostfixConfiguration {
    pub user: Cow<'static, str>,
    pub group: Option<Cow<'static, str>>,
    pub binary_path: PathBuf,
    pub process_limit: Option<u64>,
    pub map_output_path: Option<PathBuf>,
    pub transport_name: Option<Cow<'static, str>>,
}
Expand description

Settings for generating postfix configuration.

See the struct methods for details.

Fields§

§user: Cow<'static, str>

The UNIX username under which the mailpot process who processed incoming mail is launched.

§group: Option<Cow<'static, str>>

The UNIX group under which the mailpot process who processed incoming mail is launched.

§binary_path: PathBuf

The absolute path of the mailpot binary.

§process_limit: Option<u64>

The maximum number of mailpot processes to launch. Default is 1.

§map_output_path: Option<PathBuf>

The directory in which the map files are saved. Default is data_path from Configuration.

§transport_name: Option<Cow<'static, str>>

The name of the Postfix service name to use. Default is mailpot.

A Postfix service is a daemon managed by the postfix process. Each entry in the master.cf configuration file defines a single service.

The master.cf file is documented in master(5): https://www.postfix.org/master.5.html.

Implementations§

source§

impl PostfixConfiguration

source

pub fn generate_master_cf_entry( &self, config: &Configuration, config_path: &Path ) -> String

Generate service line entry for Postfix’s master.cf file.

source

pub fn generate_maps( &self, lists: &[(DbVal<MailingList>, Option<DbVal<PostPolicy>>)] ) -> String

Generate transport_maps and local_recipient_maps for Postfix.

The output must be saved in a plain text file. To make Postfix be able to read them, the postmap application must be executed with the path to the map file as its sole argument. postmap is usually distributed along with the other Postfix binaries.

source

pub fn save_master_cf_entry( &self, config: &Configuration, config_path: &Path, master_cf_path: Option<&Path> ) -> Result<(), Error>

Save service to Postfix’s master.cf file.

If you wish to do it manually, get the text output from PostfixConfiguration::generate_master_cf_entry and manually append it to the master.cf file.

If master_cf_path is None, the location of the file is assumed to be /etc/postfix/master.cf.

source

pub fn save_maps(&self, config: &Configuration) -> Result<(), Error>

Generate transport_maps and local_recipient_maps for Postfix.

To succeed the user the command is running under must have write and read access to postfix_data_directory and the postmap binary must be discoverable in your PATH environment variable.

postmap is usually distributed along with the other Postfix binaries.

Trait Implementations§

source§

impl Clone for PostfixConfiguration

source§

fn clone(&self) -> PostfixConfiguration

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PostfixConfiguration

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for PostfixConfiguration

source§

fn default() -> PostfixConfiguration

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for PostfixConfiguration

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<PostfixConfiguration, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for PostfixConfiguration

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,