mydomain = "example.com"; mykey = "bobble"; function ModifyReturnPath(mailfrom, origmailfrom) local srch = "@" .. string.gsub(mydomain, "%.", "%%.") .. "$"; if not string.find(origmailfrom, srch) then local lastAt = origmailfrom:find("[^%@]+$") local localPart = origmailfrom:sub(1, (lastAt - 2)) -- Returns the substring before '@' symbol local domainPart = origmailfrom:sub(lastAt, #origmailfrom) local timestamp = math.floor((os.time()/ (60 * 60 * 24)) % 1024); local timestampMod32 = Mod32(math.floor(timestamp / 32)) .. Mod32(timestamp % 32); local hash = VPOP3.Base64(VPOP3.SHA1(origmailfrom .. timestampMod32 .. mykey)):sub(1,4); return "SRS0=" .. hash .. "=" .. timestampMod32 .. "=" .. domainPart .. "=" .. localPart .. "@" .. mydomain; end print("nosub " .. origmailfrom); end function Mod32(x) return string.sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", x + 1, x + 1); end