You can't (reliably). You can escape the dot (using a \) in the mailbox name, but this isn't always an option. Escaping the dot isn't officially standardized anywhere that I am aware of and although it is widely supported these days there isn't any guarantee that it will be properly parsed by any consumer of that information.
See the following resources:
Email address of the person responsible for this zone and to which
email may be sent to report errors or problems. In the jargon this is
called the RNAME field which is why we called it email-addr. The email
address of a suitable DNS admin but more commonly the technical
contact for the domain. By convention (in RFC 2142) it is suggested
that the reserved mailbox hostmaster be used for this purpose but any
sensible and stable email address will work. NOTE: Format is
mailbox-name.domain.com, for example, hostmaster.example.com (uses a
dot not the more normal @ sign, since @ has other uses in the zone
file) but mail is sent to email@example.com. Most commonly ending
with a '.' (dot) but if the email address lies within this domain you
can just use hostmaster (see also example below). when to use the dot.
In DNS (see [RFC1033], [RFC1034] and [RFC1035]), the Start Of
Authority record (SOA RR) has a field for specifying the mailbox name
of the zone's administrator.
This field must be a simple word without metacharacters (such as
"%" or "!" or "::"), and a mail alias should be used on the
relevant mail exchanger hosts to direct zone administration mail to
the appropriate mailbox.
For simplicity and regularity, it is strongly recommended that the
well known mailbox name HOSTMASTER always be used