I'm giving support to a production application which is already able to send emails and also to read bounced emails.
When the applications needs to send an email it fetches DNS MX records from myemaildomain.com, currently that dnslookup resolves to two hosts.
I understand that in order to set where the email will be bounced to (in case of delivery failure e.g. hard bounce, soft bounce, etc.) the ENVELOPE MAIL FROM must be set with the domain name where it is desired to send the bounce email to, e.g bounce.myemaildomain.com
What I don't understand is why the application is setting the ENVELOPE MAIL FROM as
new StringBuilder(32).append("return-").append(UUID.randomUUID().toString()).append("@").append("anothercompanydomain.com");
An example would be: "[email protected]"
Also the application is starting a local SMTP server to read bounced emails, but this is also the part I don't understand, how is this SMTP server able to read the bounced emails if the domain where this app is hosted is different than anothercompanydomain.com? Also if the ENVELOPE MAIL FROM is variable because of VERP how is it reading all bounced emails with a single account?