Results 1 to 13 of 13

Thread: Auto Email Checker - [Advice Needed]

  1. #1

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Auto Email Checker - [Advice Needed]

    good day and season greetings,

    am not sure as to how to explain this, i want a cron job to check if there are any new emails for a subdomain.

    the domain being something like, posts.mysite.com - so if an email is sent to [email protected](which does not exists).it should be posted to an application on my website.

    the cron job(i can do), but with the emails, am thinking i should create a CatchAll email address on that subdomain.so any new emails in the CatchAll address should be validated then sent to the application.

    what do you think?

    and oh, my language is PHP.
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Auto Email Checker - [Advice Needed]

    Yes, you are going to want to use CatchAll for that subdomain.

    Then use IMAP to go through the emails, and do what you need.

  3. #3

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: Auto Email Checker - [Advice Needed]

    Thanks for the reply dclamp, i'll go through the IMAP reference.

    on more thing, am using cPanel and i just discovered that there is a way to pipe emails sent to a non-existing address to a program.

    but how do i write my script to detect the To/Subject/Body of the message(cos, am thinking the script won't receive the email as an actual email message).

    well...i don't know if this makes sense to anyone here(except myself).
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  4. #4
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Auto Email Checker - [Advice Needed]

    I understand waht your saying. With IMAP there are strings for to/subject/body/etc...

    Just read over the reference, and it should help. If you are going with PHP, This thread should be moved.

  5. #5

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: Auto Email Checker - [Advice Needed]

    thanks dclamp, i guess i'll have to pay more attention to IMAP.

    but what if my web host does not support it, POP is supported - will it work?

    and yes my language is PHP.
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Auto Email Checker - [Advice Needed]

    Thanks dclamp, moved to PHP forum.

  7. #7
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Auto Email Checker - [Advice Needed]

    i am pretty sure IMAP supports pop connections. Might want to double check. Have you started anything yet?

  8. #8

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: Auto Email Checker - [Advice Needed]

    yes, i have(but locally).
    what i noticed is that it refuses to open the protocol on all my ports(143/IMAP, 110/POP3).

    it keeps returning with the error

    Warning: imap_open() [function.imap-open]: Couldn't open stream {localhost:110}INBOX in D:\dirname\xampp\htdocs\test.php on line 106

    Fatal error: Maximum execution time of 60 seconds exceeded in D:\dirname\xampp\htdocs\test.php on line 106


    and i don't know why.
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  9. #9
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Auto Email Checker - [Advice Needed]

    post your code.

  10. #10

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: Auto Email Checker - [Advice Needed]

    ok, well here's the code
    Code:
    $server = "{localhost:110}INBOX";
    $link=imap_open($server,"username","password");
    $headers = imap_headers($link);
    
    for($x=1; $x < count($headers); $x++) {
        $idx=($x-1);
        echo "<a href=\"view.php3?num=$x\">$headers[$idx]</a><br>";
    }
    and the response again is

    Warning: imap_open() [function.imap-open]: Couldn't open stream {localhost:110}INBOX in D:\dirname\xampp\htdocs\test.php on line 106

    Fatal error: Maximum execution time of 60 seconds exceeded in D:\dirname\xampp\htdocs\test.php on line 106
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  11. #11
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Auto Email Checker - [Advice Needed]

    if you're trying to connect to a pop3 server (because you said above you weren't sure if your host supported imap?), then you need to specify that:
    PHP Code:
    // To connect to a POP3 server on port 110 on the local server, use:
    $mbox imap_open ("{localhost:110/pop3}INBOX""user_id""password"); 
    you can read more here.

    also, using "localhost" requires you to actually have a mail server installed on your system. if you do not, then you just need to replace that with an actual mail server, like mail.mydomain.com.

  12. #12

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: Auto Email Checker - [Advice Needed]

    Quote Originally Posted by kows
    also, using "localhost" requires you to actually have a mail server installed on your system. if you do not, then you just need to replace that with an actual mail server, like mail.mydomain.com.
    i do have a local mail server(Mercury).

    i did tried the above example, no errors but it returned nothing(mind you, the mailbox has over 10 messages in it).
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  13. #13
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Auto Email Checker - [Advice Needed]

    well, my test script that logs into gmail via IMAP and dumps my mailbox works fine, so I'm not sure what to tell you. make sure your username is the full [email protected] and not just emailaddress. I also read this comment on php.net, you may want to try it:

    Code:
    Beginning with 5.2.2, binaries built for Windows also seem to have changed its default behavior.
    '/notls' needs to be specified for a non-SSL connection.
    if you can, I might also try to use an outside mail server that you know is operating correctly (just in case yours might not be).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width