I'm currently using both the MIMEDecode and MIMEMessage to process some email for a local organisation.
One of the requirements is to resend an email but with a modified To: field but for the rest of the email to remain unchanged... as if the original author had used the modified to: field.
I've been able to forward the email as an attachment; but as the APIs aren't quite symetric it's not as easy to work out how to do the resend simply.
Suggestions welcome as to an approach here. (Ideally I wouldn't be using a php script but the are other requirements that mean the hosting email forwarding can't be used sadly).
Manuel Lemos - 2016-10-15 20:26:35 - In reply to message 1 from Matthew White
I already thought and adding a function to MIME message to take MIME parser output and rebuild the message. So this is a useful idea that other people may be interested.
Matthew White - 2016-10-16 07:52:01 - In reply to message 2 from Manuel Lemos
Thank you for the response, currently I'm working on taking the headers/bodies that I suspect might come in and then setting on the out message. So far ok - but suspect one email will come in that has something unusual :-)
If you have a beta version would be happy to try it!
Manuel Lemos - 2016-10-16 09:24:34 - In reply to message 3 from Matthew White
It it is just a matter of replacing the To: header, you may just find the header line and replace it with whatever values. Just keep in mind that headers may span multiple lines.