I am retrieving the emails and then parsing into the database.
But the problem is i am able to retrieve the email but the attachment part is also shown on the browser.I need to save this attachment part to the some location .The format of attachment is text/plain.
here is my code
<?php
$inbox=imap_open("{xyz.com:995/pop3/ssl/novalidate-cert}INBOX", "username", "password");
$count = imap_num_msg($inbox);
for($i = 1; $i <= 1; $i++) {
$raw_body = imap_body($inbox, $i);
echo $raw_body;
imap_delete($inbox, 1);
}
imap_expunge ($inbox);
?>
here i have retrievd a email
But i dont know how to save the attachment .
The attachment is also shown below the body of the email when i am using the imap_body.
So how should i separate these two..
by analysing the mail with imap_fetchstructure() you can get a list to the different parts of the mail. With a imap_fetchstructure(), you actually take the parts interesting to you. Have a look at the latter documentation for an example code in the comments.