PC Nerd Posted May 28, 2007 Share Posted May 28, 2007 hi guys, im setting up a third party email for my domain...... so that i can create xyz@domain.com, and keep emails etc even while i change hosts etc. however, what i want to do is setup an account, for contact, and have filters, that keeps track of 5 other email boxes...... and forward each incoming email into the first email, to the email with the lowest emails.... ill explain further: email2me.com: main email box 1@... = 27 emails sent to. 2@... = 27 emails sent to 3@... = 25 emails sent to 4@... = 30 emails sent to what i want to happen, is when an email comes into email@me.com, i want it to automatically forward that email to the other email ( 1@ 2@ etc) address, who has the lowest amount of emails been sent to them. i can store the number in a database, or even a text file if i needed, however, i need like a) a cron setup or something, that logs into othe emal service, then forwards that email. is this possible with php, or how would i go about it. what it really is, is to spead like support emails and requests, amongst support technitions etc, so that they can have their own personal emails, and the global one ( email@me.com) doesnt have to have multiple logged into it etc. i dont even know if this is possible within php, but is it possible to automatically do it through my DNS management, where its edited MX records etc? thanks for your help in advance, yours, PC Nerd Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 28, 2007 Share Posted May 28, 2007 NO DOUBLE POSTS. i told you last time to google for it yet you just created another post..! Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted May 28, 2007 Author Share Posted May 28, 2007 i dont want a script, i want to know if its possible to do in php only, is it really that hard.... btw, i asked something there, and didnt get answered, so instead of bumping 50 times, i just posted new...... Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 28, 2007 Share Posted May 28, 2007 btw, i asked something there, and didnt get answered, so instead of bumping 50 times, i just posted new...... Oh yeah like that make sense! Yes is possible in php, MX will affect all emails on the domain! Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted May 28, 2007 Author Share Posted May 28, 2007 would there be a way to only monitor a particular email address? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 28, 2007 Share Posted May 28, 2007 Yes.. break the job up into smaller sections.. ie moniting could be done via crons etc filtering mail is basically reading the mail and running a filter (maybe regex) without user interaction agina cronjobs Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted May 28, 2007 Author Share Posted May 28, 2007 um, would it be better if i vhave a cron, running on the hour or something..... that runs as a POP3 client? then it would have complete control over the emails? if so, could someone point me in the way is a nice tutorial, thats reasonably simple? thanks for your help, Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 28, 2007 Share Posted May 28, 2007 read pop3.class.inc theirs tons on cronjob (if you have cPanel it will be in their as well) Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted May 28, 2007 Author Share Posted May 28, 2007 thanks, will do Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted May 28, 2007 Author Share Posted May 28, 2007 ok, firstly thanks. Im not really familiar with the -> functions etc.... also, is there a simple way to retreive email using php, even if its not POP3? the only thing im looking for, is the ability to forward an email..... i dont even have to be able to read anything... etc. thanks for your help, Yours PC_Nerd Quote Link to comment Share on other sites More sharing options...
MadTechie Posted May 28, 2007 Share Posted May 28, 2007 -> is just the way you handle classes.. the reason i posted how to read is because your need to read in the mail and then send it out.. i don't know of another way to forward them (direct from php).. if not pop3 then maybe imap.. if you have imap support <?php phpinfo(); ?> you could just read the IMAP section <?php $server = "domain.com"; $user = "mad"; $pass = "techie"; $conn = @imap_open("\{$server/imap}INBOX", $user, $pass)or die("Connection to server failed"); $headers = @imap_headers($conn) or die("Couldn't get emails"); $numEmails = sizeof($headers); echo "You have $numEmails in your mailbox"; for($i = 1; $i < $numEmails+1; $i++) { $mailHeader = @imap_headerinfo($conn, $i); $from = $mailHeader->fromaddress; $subject = strip_tags($mailHeader->subject); $date = $mailHeader->date; echo "Email from $from, subject $subject, date $date<br>"; $body = nl2br(strip_tags(imap_body($conn, $i))); echo "$body<br>"; } imap_close($conn); ?> hope this helps (was ripped from an old project) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.