Sendmail has some pretty comprehensive rewrite rules, but I've never really got into them. Maybe it can handle it (but you'd probably need to do a lot of reading to know for sure).

Also you might...