ballouta Posted September 10, 2008 Share Posted September 10, 2008 Hello i have this ereg that reads a returned email with non exisitng email addresses, it works good but it repeats each email address twice or three times according to how many times it is mentioned in the returened email: <?php preg_match_all('#([^\s<]+@[^\s>]+)#', $message, $matches); for($i = 0, $total = count($matches[0]); $i < $total; $i++){ echo $matches[0][$i] . '<br />'; } ?> example of a delviery failure message (twice repeated): Message from yahoo.co.uk. Unable to deliver message to the following address(es). <[email protected]>: This user doesn't have a yahoo.co.uk account ([email protected]) [0] Would you please help me solve this problem? thank You Link to comment https://forums.phpfreaks.com/topic/123657-solved-repeated-result/ Share on other sites More sharing options...
effigy Posted September 10, 2008 Share Posted September 10, 2008 <pre> <?php $message = <<<MSG Message from yahoo.co.uk. Unable to deliver message to the following address(es). <[email protected]>: This user doesn't have a yahoo.co.uk account ([email protected]) MSG; preg_match_all('#[^\s<()]+@[^\s>()]+#', $message, $matches); foreach (array_unique($matches[0]) as $match) { echo $match, '<br />'; } ?> </pre> Link to comment https://forums.phpfreaks.com/topic/123657-solved-repeated-result/#findComment-638558 Share on other sites More sharing options...
ballouta Posted September 10, 2008 Author Share Posted September 10, 2008 thanks alot you are genius it is working Link to comment https://forums.phpfreaks.com/topic/123657-solved-repeated-result/#findComment-638564 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.