def METHOD_NAME(self, dir, mbox=False):
    t = int(time.time() % 1000000)
    pid = self._counter
    self._counter += 1
    filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain"))
    tmpname = os.path.join(self._dir, "tmp", filename)
    newname = os.path.join(self._dir, dir, filename)
    with open(tmpname, "w") as fp:
        self._msgfiles.append(tmpname)
        if mbox:
            fp.write(FROM_)
        fp.write(DUMMY_MESSAGE)
    if hasattr(os, "link"):
        os.link(tmpname, newname)
    else:
        with open(newname, "w") as fp:
            fp.write(DUMMY_MESSAGE)
    self._msgfiles.append(newname)
    return tmpname