Together with macOs Monterey apple published MailKit for apple Mail. (https://developer.apple.com/documentation/mailkit)
I would like to create an apple Mail extension that can manipulate the from address depending on the to address of a new E-Mail.
I created an extension that include a compose session handler:
"A compose session handler validates recipient email addresses, displays a view controller on Mail’s compose windows, confirms if messages are suitable for delivery, and adds custom headers."
The compose session has a property with the content of the e-mail: MEMessage (https://developer.apple.com/documentation/mailkit/memessage) unfortunately all properties of MEMessage are readonly properties.
Is there a different way to manipulate the content of the mail?
Why i would like to have a function to manipulate the from address:
I have quite a long list of from E-Mail Addresses. Every E-Mail Account on my mailserver has a wildcard option so next to user@domain.tld you could also use user_something@domain.tld. I use an unique e-mail address where ever i can. If one E-Mail Address get's to much spam i simply block the Address on the Server.
If the from E-mail Adress is added to apple mail, it will be set automatically when i answer an e-mail that i received. But if i write a new e-mail i have to set the from address manually.
Since only the mail address varies and not the senders name, it's quite hard to select it from the long list. Also whenever i first want to write (or answer) with an e-mail address that is not added to the settings, i need to add it in the settings first. I was hoping that i could write an add-on to simplify this process.
This would also be nice if you have lot's of different e-mail accounts. E.g one private, one for work. Than you could maintain a list of receivers with the depending from address.