extracting method to level build_xsmtpapi's calls logic