I am connecting to a POP3 mailbox using PHP Imap, its connecting fine and i have this to receive my header info:
$header=imap_headerinfo($inbox,$email_number);
$from = $header->from[0]->mailbox . "@" . $header->from[0]->host;
$toaddress=$header->toaddress;
$replyto=$header->reply_to[0]->mailbox."@".$header->reply_to[0]->host;
$datetime=date("Y-m-d H:i:s",$header->udate);
$subject=$header->subject;
the $toaddress
is showing User Name <username@domain.com>
how can i make it show just username@domain.com
for example, the actual email addresses are like 1234@domain.com and i need to retrieve the number only with nothing else
is this possible?
You should use the "to" array from $header:
$email = $header->to[0]->mailbox.'@'.$header->to[0]->host';
More info here:
I have managed to work it out by using
$toaddress=$header->to[0]->mailbox."@".$header->to[0]->host;