The set_addr function now properly checks that both addr.user and addr.domain
are non-empty strings before constructing addr.addr and addr.raw. This prevents
creating malformed addresses like '@domain.com' when addr.user is empty, and
ensures consistent state when addr.domain is empty.
addr.domain = new_domain
end
- -- Only update if we have both user and domain
- if addr.user and addr.domain and addr.domain ~= '' then
+ -- Only update if we have both user and domain as non-empty strings
+ if addr.user and addr.user ~= '' and addr.domain and addr.domain ~= '' then
addr.addr = string.format('%s@%s', addr.user, addr.domain)
if addr.name and #addr.name > 0 then