Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Get mail with PHP
there is a way  to get the mails from a POP3 server using a PHP web based
application.Where i can found information about the libriries.

thanks



Report this thread to moderator Post Follow-up to this message
Old Post
Panci
04-15-05 08:56 PM


re:Get mail with PHP
Here is a sample PHP script that will show the number of messages you
have on your mail server.

> <?
>
 ########################################
 ###############################
> # checkmail.php  | last update Apr-10-2005  |  Cyberdine Systems
#
> #
#
> # INFO
#
> # Checkmail displays the number of messages in a POP3
#
> # mailbox without downloading or viewing any of the messages.
#
> #
#
> # USAGE
#
> # Requires PHP4. Set the $host, $user, and $pass variables below and
#
> # execute the script.
#
> #
#
> # LICENSE
#
> # This script is absolutely free. Use at will. The author is not
#
> # responsible for lost email, blown up servers, or anything else
that #
> # results from the use of this script.
#
>
 ########################################
 ###############################
>
> $host = "mailserver";
> $user = "username";
> $pass = "password";
>
>
 ########################################
 ###############################
> # End Configuration
#
>
 ########################################
 ###############################
> #Until I rewrite my scripts, this will suffice for
bg-compatibility;
> if(phpversion() >= "4.2.0"){
>    extract($_POST);
>    extract($_SERVER);
>    extract($_ENV);
> }
>
> #Format output for console or for web?
> $nl = ((isset($REMOTE_ADDR)) ? "<br>" : "\n");
>
> if(!$sock=fsockopen($host, 110, $err, $errno, 10))
>   die("Couldn't connect to the POP server$nl");
>
> fputs($sock, "USER $user\r\n");
> $buf = fgets($sock, 1024);
> if($buf[0] != '+')
>   die("POP server didn't like USER $user$nl");
> sleep(3);
> fputs($sock, "PASS $pass\r\n");
> $buf = fgets($sock, 1024);
> if($buf[0] != '+')
>   die("POP server didn't like PASS$nl");
> sleep(3);
>
> fputs($sock, "STAT\r\n");
>
> $buf = fgets($sock, 1024);
> fputs($sock, "STAT\r\n");
> $buf2 = fgets($sock, 1024);
> list($stat, $num, $size) = split(' ', $buf2, 3);
> echo "There are $num message(s)$nl";
> fputs($sock, "QUIT\r\n");
> $buf = fgets($sock, 1024);
> fclose($sock);
>
> ?>
>


Report this thread to moderator Post Follow-up to this message
Old Post
Library Curator
04-17-05 08:57 AM


re:Get mail with PHP
Here is a sample PHP script that will show the number of messages you
have on your mail server.

> <?
>
 ########################################
 ###############################
> # checkmail.php  | last update Apr-10-2005  |  Cyberdine Systems
#
> #
#
> # INFO
#
> # Checkmail displays the number of messages in a POP3
#
> # mailbox without downloading or viewing any of the messages.
#
> #
#
> # USAGE
#
> # Requires PHP4. Set the $host, $user, and $pass variables below and
#
> # execute the script.
#
> #
#
> # LICENSE
#
> # This script is absolutely free. Use at will. The author is not
#
> # responsible for lost email, blown up servers, or anything else
that #
> # results from the use of this script.
#
>
 ########################################
 ###############################
>
> $host = "mailserver";
> $user = "username";
> $pass = "password";
>
>
 ########################################
 ###############################
> # End Configuration
#
>
 ########################################
 ###############################
> #Until I rewrite my scripts, this will suffice for
bg-compatibility;
> if(phpversion() >= "4.2.0"){
>    extract($_POST);
>    extract($_SERVER);
>    extract($_ENV);
> }
>
> #Format output for console or for web?
> $nl = ((isset($REMOTE_ADDR)) ? "<br>" : "\n");
>
> if(!$sock=fsockopen($host, 110, $err, $errno, 10))
>   die("Couldn't connect to the POP server$nl");
>
> fputs($sock, "USER $user\r\n");
> $buf = fgets($sock, 1024);
> if($buf[0] != '+')
>   die("POP server didn't like USER $user$nl");
> sleep(3);
> fputs($sock, "PASS $pass\r\n");
> $buf = fgets($sock, 1024);
> if($buf[0] != '+')
>   die("POP server didn't like PASS$nl");
> sleep(3);
>
> fputs($sock, "STAT\r\n");
>
> $buf = fgets($sock, 1024);
> fputs($sock, "STAT\r\n");
> $buf2 = fgets($sock, 1024);
> list($stat, $num, $size) = split(' ', $buf2, 3);
> echo "There are $num message(s)$nl";
> fputs($sock, "QUIT\r\n");
> $buf = fgets($sock, 1024);
> fclose($sock);
>
> ?>
>


Report this thread to moderator Post Follow-up to this message
Old Post
Library Curator
04-23-05 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:17 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.