11 Connection(int fd_in
, int fd_out
, std::function
<void(void)> read_hook
)
15 std::chrono::minutes(2),
16 std::chrono::minutes(2))
22 std::string server_id
;
25 std::vector
<Mailbox
> rcpt_to
;
27 std::string ehlo_keyword
;
28 std::vector
<std::string
> ehlo_param
;
29 std::unordered_map
<std::string
, std::vector
<std::string
>> ehlo_params
;
31 std::string reply_code
;
33 bool greeting_ok
{false};
35 bool active
{false}; // At least one rcp_to for this MX
37 bool has_extension(char const* name
) const
39 return ehlo_params
.find(name
) != ehlo_params
.end();
46 Send(fs::path config_path
, char const* service
);
48 void set_sender(Domain sender
) { sender_
= sender
; }
50 bool mail_from(Mailbox
const& from
);
51 bool rcpt_to(DNS::Resolver
& res
, Mailbox
const& to
, std::string
& error_msg
);
53 bool send(std::string_view msg
);
59 fs::path config_path_
;
65 std::vector
<Mailbox
> rcpt_to_
;
67 // MX hostname or address => connection
68 std::unordered_map
<Domain
, std::unique_ptr
<SMTP::Connection
>> exchangers_
;
70 // @domain => MX hostname or address
71 std::unordered_map
<Domain
, Domain
> receivers_
;
74 #endif // SEND_DOT_HPP