Forum Moderators: coopster
$link = imap_open("{localhost/imap}","name","pass");
$headers = imap_headers($link);
for($n=1;$n<count($headers);$n++){
echo "stuff";
}
since the page comes out blank i assume the for loop is never activated
did i do something wrong?
[edited by: jatar_k at 11:52 pm (utc) on Aug. 2, 2004]
[edit reason] fixed quote tags [/edit]
<?
if (!$link = imap_open("{localhost/imap}","name","pass"))
{
echo "Failed to open";
exit;
}if (!$headers = imap_headers($link))
{
echo "No headers";
exit;
}for($i=1;$i<count($headers);$i++){
$h = imap_headerinfo($link,$i);
$b = imap_body($link,$i);
$from = "From: send<name@site.com>\n";
$body = $b;
mail($h['fromaddress'],"picture",$body,$from);
imap_delete($link,$i);
echo "sent <i>".$b."</i> to <b>".$h['fromaddress']."</b><br>";
}
?>
i don't get the message because $h['fromaddress'] shows up blank. if i do a print_r($h) or a foreach($h as $k => $v)... it works. but accessing it as $h['fromaddress'] does not.
on my echo statement, the message looks like this
sent --NextPart_Webmail_9m3u9jl4l_21881_1091489870_0 Content-Type: text/plain Content-Transfer-Encoding: 8bit my message --NextPart_Webmail_9m3u9jl4l_21881_1091489870_0 Content-Type: text/html Content-Transfer-Encoding: 8bit my message --NextPart_Webmail_9m3u9jl4l_21881_1091489870_0-- to
the delete thing doesn't work either so every time i run this script the same e-mail will be sent out