So, basically I have the PHP imap_open code (idk how to call it) that works when you log in with a specific email address. What I want to do is to log in with the mail server's root user(I'm guessing that's what it's called, it's the account that the hosting provider gave me when ordering) and retrieve the inbox of any email address.
The point of making this is that I want to make an online email client that people can use while logging in using a custom auth system that has nothing to do with the mail server (and every user has his email address in a database).
I thought about saving an encrypted password of the email address in the database and using that to log in to individual email addresses but I'm not a big fan of that idea.
I would like to know if that's even possible and maybe any ideas on how you would solve the problem with saving each email's password safe.
P.S. I did manage to use the root account to send emails from any address on the mail server using SMTP PHPMailer.
I know that I'm bad at explaining things, sorry about that and thanks in advance.
I'm curently using this code to get the inbox of a email address using the specific email address password.
$inbox = imap_open('{mail.example.com:993/imap/ssl}INBOX', 'user@example.com', 'password');
/* grab emails */
$emails = imap_search($inbox,'ALL');
/* if emails are returned, cycle through each... */
if($emails) {
/* begin output var */
$output = '';
/* put the newest emails on top */
rsort($emails);
/* for every email... */
foreach($emails as $email_number) {
/* get information specific to this email */
$overview = imap_fetch_overview($inbox,$email_number,0);
$output.= 'Name: '.$overview[0]->from.'</br>';
$output.= 'Email: '.$overview[0]->message_id.'</br>';
$body = imap_fetchbody($inbox, $email_number, 0);
$output.= 'Head: '.$body.'</br>';
$body = imap_fetchbody($inbox, $email_number, 1);
$output.= 'Body: '.$body.'</br>';
break;
}
echo $output;
}
/* close the connection */
imap_close($inbox);