PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$Details = GetMail(); // How do get this done ?
echo $Details['Headers'].'<br/>';
echo $Details['Subject'].'<br/>';
echo $Details['Message'].'<br/>';
?>
1. How do I get $Details = GetMail(); // How do get this done ? done ?
2. How I get getmail.php to run when a new mail has arrived to a particular account ? - [Same domain, server etc]
If 2 is not possible then I can set a cron for every 10 mins or so but how to read the mail contents ?
1. On my Linux server, email is stored in a flat file in a regular format. Needless to say, I can just open that file and rip it apart to get the contents. On my server, email is stored in the file /var/mail/[account name]
2. I think you'll have to go with a cron job for this.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
I've seen this before but is this standard ? How can I know the actual path of the mail folder ?
Do all hosting solutions provide mail in var or is this dependent on the distro ?
It's probably dependant on the host unfortunately. There's probably an elegant way to use the imap functions to login to the mail server and get the contents. SquirrelMail and Ilohamail are written in PHP so they might be a good place to start.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
if you have root privs on the server, you can set an email alias to pipe the new email into any php or perl or python script. I did this for a email trouble ticket system once, I cant recall the particulars off the top of my head, however but I know it's doable, and it's google-able
like trukfixer said pipe the email, you do this in the configuration files of your mail server, you can actually pipe it to anything that can be run on the command line, so for instance a PHP shell script