Auto-forwarding emails, but removing parts of the message? Possible?

Status
Not open for further replies.

Sonny Forelli

Well-known member
May 8, 2008
2,330
89
48
Liberty City
I'd like to setup an email address to forward all emails to another email recipient but remove parts of the message that are always in the body

(ie let's say I'm outsourcing making phone calls to india and don't want the operators to receive certain "this lead send to you by...." information).

Where would I start to do something like this?
 


str_replace(); will be useful to remove the text after fetching it.
PHP:
$newmail = str_replace("$mail", "This lead is sent to you by...", "");

$mail would be the whole email. The second bit will find the term "This lead is sent to you by...". The third bit will replace the term with the contents of that bit.

Then using mail(); you would send $newmail which would have the stuff removed.

Hope it helps.
 
Sohan - you have the str_replace arguments the wrong way round. They should be:

str_replace(WHAT_TO_SEARCH_FOR, WHAT_TO_REPLACE_IT_WITH, $mail);

Damned PHP :)
 
Status
Not open for further replies.