global::transport
Functions to configure delivery methods of emails.
fn
forward
fn forward(rcpt: String, forward: SharedObject) -> ()
fn forward(rcpt: SharedObject, forward: SharedObject) -> ()
fn forward(rcpt: String, forward: String) -> ()
fn forward(rcpt: SharedObject, forward: String) -> ()
Set the delivery method to forwarding for a single recipient.
After all rules are evaluated, forwarding will be used to deliver
the email to the recipient.
rcpt
- the recipient to apply the method to.target
- the target to forward the email to.
All of them.
#{
rcpt: [
action "forward (str/str)" || {
envelop::add_rcpt("my.address@foo.com");
transport::forward("my.address@foo.com", "127.0.0.1");
},
action "forward (obj/str)" || {
let rcpt = address("my.address@bar.com");
envelop::add_rcpt(rcpt);
transport::forward(rcpt, "127.0.0.2");
},
action "forward (str/obj)" || {
let target = ip6("::1");
envelop::add_rcpt("my.address@baz.com");
transport::forward("my.address@baz.com", target);
},
action "forward (obj/obj)" || {
let rcpt = address("my.address@boz.com");
envelop::add_rcpt(rcpt);
transport::forward(rcpt, ip4("127.0.0.4"));
},
],
}
#
#
#
Or with url:
#{
rcpt: [
action "set forward" || {
let user = "root@domain.tld";
let pass = "xxxxxx";
let host = "smtp.domain.tld";
let port = 25;
transport::forward_all(`smtp://${user}:${pass}@${host}:${port}?tls=opportunistic`);
},
]
}
#
fn
forward_all
fn forward_all(forward: String) -> ()
fn forward_all(forward: SharedObject) -> ()
Set the delivery method to forwarding for all recipients.
After all rules are evaluated, forwarding will be used to deliver
the email.
target
- the target to forward the email to.
All of them.
#{
rcpt: [
action "forward_all" || {
envelop::add_rcpt("my.address@foo.com");
envelop::add_rcpt("my.address@bar.com");
transport::forward_all("127.0.0.1");
},
action "forward_all (obj)" || {
envelop::add_rcpt("my.address@foo2.com");
envelop::add_rcpt("my.address@bar2.com");
transport::forward_all(ip4("127.0.0.1"));
},
],
}
fn
deliver
fn deliver(rcpt: String) -> ()
fn deliver(rcpt: SharedObject) -> ()
Set the delivery method to deliver for a single recipient.
After all rules are evaluated, the email will be sent
to the recipient using the domain of its address.
rcpt
- the recipient to apply the method to.
All of them.
#{
rcpt: [
action "deliver (str/str)" || {
envelop::add_rcpt("my.address@foo.com");
transport::deliver("my.address@foo.com");
},
action "deliver (obj/str)" || {
let rcpt = address("my.address@bar.com");
envelop::add_rcpt(rcpt);
transport::deliver(rcpt);
},
action "deliver (str/obj)" || {
let target = ip6("::1");
envelop::add_rcpt("my.address@baz.com");
transport::deliver("my.address@baz.com");
},
action "deliver (obj/obj)" || {
let rcpt = address("my.address@boz.com");
envelop::add_rcpt(rcpt);
transport::deliver(rcpt);
},
],
}
fn
deliver_all
fn deliver_all() -> ()
Set the delivery method to deliver for all recipients.
After all rules are evaluated, the email will be sent
to all recipients using the domain of their respective address.
All of them.
#{
delivery: [
action "setup delivery" || transport::deliver_all(),
]
}
#{
rcpt: [
action "deliver_all" || {
envelop::add_rcpt("my.address@foo.com");
envelop::add_rcpt("my.address@bar.com");
transport::deliver_all();
},
],
}
fn
mbox
fn mbox(rcpt: String) -> ()
fn mbox(rcpt: SharedObject) -> ()
Set the delivery method to mbox for a recipient.
After all rules are evaluated, the email will be stored
locally in the mail box of the recipient if it exists on the server.
rcpt
- the recipient to apply the method to.
All of them.
#{
delivery: [
action "setup mbox" || transport::mbox("john.doe@example.com"),
]
}
#{
rcpt: [
action "setup mbox" || {
const doe = address("doe@example.com");
envelop::add_rcpt(doe);
envelop::add_rcpt("a@example.com");
transport::mbox(doe);
transport::mbox("a@example.com");
},
],
}
fn
mbox_all
fn mbox_all() -> ()
Set the delivery method to mbox for all recipients.
After all rules are evaluated, the email will be stored
locally in the mail box of all recipients if they exists on the server.
All of them.
#{
delivery: [
action "setup mbox" || transport::mbox_all(),
]
}
#{
rcpt: [
action "setup mbox" || {
const doe = address("doe@example.com");
envelop::add_rcpt(doe);
envelop::add_rcpt("a@example.com");
transport::mbox_all();
},
],
}
fn
maildir
fn maildir(rcpt: SharedObject) -> ()
fn maildir(rcpt: String) -> ()
Set the delivery method to maildir for a recipient.
After all rules are evaluated, the email will be stored
locally in the `~/Maildir/new/` folder of the recipient's user if it exists on the server.
rcpt
- the recipient to apply the method to.
All of them.
```ignore
#{
delivery: [
action "setup maildir" || transport::maildir("john.doe@example.com"),
]
}
```
#{
rcpt: [
action "setup maildir" || {
const doe = address("doe@example.com");
envelop::add_rcpt(doe);
envelop::add_rcpt("a@example.com");
transport::maildir(doe);
transport::maildir("a@example.com");
},
],
}
fn
maildir_all
fn maildir_all() -> ()
Set the delivery method to maildir for all recipients.
After all rules are evaluated, the email will be stored
locally in each `~/Maildir/new` folder of they respective recipient
if they exists on the server.
All of them.
#{
delivery: [
action "setup maildir" || transport::maildir_all(),
]
}
#{
rcpt: [
action "setup maildir" || {
const doe = address("doe@example.com");
envelop::add_rcpt(doe);
envelop::add_rcpt("a@example.com");
transport::maildir_all();
},
],
}