I have a cPanel web hosting account. On this account I have a PHP-based support/trouble ticket system for my customers to use. I'd like to be able to send an email to both my customer and to the ticket system, but have the email that goes to the ticketing system appear to come from my customer, so that the support ticket which gets created appears under their account.So what I want to do is create some email address billing-redirect@mydomain.com which gets piped to a unix command or shell script. This means that when I send an email from billing@mydomain.com to some_customer@example.com and CC billing-redirect@mydomain.com, the shell script should be able to resend the email to support@mydomain.com but resend the email from the To: address of the email.Is there any way to make a shell script which will accept an email on stdin, rewrite the From: address, and resend the mail to a new address? Can Procmail do anything like that? Or will I have to hand code this myself?
How can I rewrite the From: address of an email and resend it?
scripting;email
Procmail comes with the formail command to manipulate mail headers. The procmailex contains examples of uses in .procmailrc. This should do what you want (untested):formail -R To: From: -U From: -I Cc: -I 'To: support@mydomain.com'