hi ,
I have a problem with a mail server.
This mail server has top secure.
I will connect to this mail server with a username and password to my account.
At first time I connect to mail server successfully.
If I connect to my account again, the mail server will not allow.
But after 3 or 4 seconds the mail server allows me to connect to my account.
I connect to the mail server with imap_open().
this mail server is pop.hotpop.com.
for example address email is "username@hotpop.com".
if you will test it you can create a free account in http://www.hotpop.com
mail server secure
Moderator: General Moderators
I don not know much about imap, but in the old ages of pop3 (
) it was quite common to let keep the file lock (or lock-file) even when the user logged out and check the create time at the next login attempt.
This way numerous logins in a short interval could be prevented.
Why do you want to login so often?
This way numerous logins in a short interval could be prevented.
Why do you want to login so often?
Re:Why do you ........?
I use functions in my script.
E.g. I have a function to read only header.
Another function to read only number of emails.
And another function to read only body of email.
Etc.
They need to connect to mail server.
I use for each function an imap_open.
I know this work is wrong but …..
I try to use imap_open() function only for first time and to pass the result of imap_open() to another functions but it does fail.
E.g. I have a function to read only header.
Another function to read only number of emails.
And another function to read only body of email.
Etc.
They need to connect to mail server.
I use for each function an imap_open.
I know this work is wrong but …..
I try to use imap_open() function only for first time and to pass the result of imap_open() to another functions but it does fail.
you can store the connection-id in $GLOABLS, all functions can access this array.
http://www.php.net/manual/en/reserved.v ... es.globals
http://www.php.net/manual/en/reserved.v ... es.globals
test new way
hi dear
in this script used global variable.
but i have problem yet.
there is source of progrom in the bottom of this page.
if you connect to mail box, this script show number of message in your mail box.
then if you do refresh your page for more time you will see a Warning.
i think my algorithm is fail.
i need guide
bay
theWarning is:
Warning: Couldn't open stream {pop.hotpop.com:110/pop3} in /..../...../...????.php on line 5
the new script is :
<?php
require('functions.php');
if(!session_is_registered('loggedin'))
{
$pop=imap_open("{ your server:110/pop3}","user name ","your password");
}
//-----------------main part-------------------//
switch ($action)
{
###############################
// show a email //
###############################
case 'get_mail':
if(session_is_registered('loggedin'))
{$num=num();
if(isset($mail) and ($mail>0 and $mail<=$num))
{
/* get a message
.
.
.
.
*/
}
}
break;
###############################
// show all mail //
###############################
default:
$num=num();
switch ($num)
{
case -1:
/*--------//
.
.
.
show "you did fail"...........
.
.
.
//--------*/
break;
case 0:
session_register('loggedin');
$loggedin = 1;
$num_msg = 0;
/*--------//
.
.
.
show "you havent any emil in your inbox"...........
.
.
.
//--------*/
break;
default:
session_register('loggedin');
$loggedin = 1;
$num_msg=$num;
///-------------///
echo $num_msg;
///------------///
break;
}
break;
###############################
// end //
###############################
}
?>
and function source is:
<?php
function num()
{
if ($GLOBALS['pop'] == false)
return (-1);
else
{
if (($num_messages = @imap_num_msg($GLOBALS['pop'])) == 0)
{
return (0);
}
else
{
return($num_messages);
}
}
}
function inbox(........)
{
/*
.
.
.
*/
}
function get_mail(.......)
{
/*
.
.
.
*/
}
?>
in this script used global variable.
but i have problem yet.
there is source of progrom in the bottom of this page.
if you connect to mail box, this script show number of message in your mail box.
then if you do refresh your page for more time you will see a Warning.
i think my algorithm is fail.
i need guide
bay
theWarning is:
Warning: Couldn't open stream {pop.hotpop.com:110/pop3} in /..../...../...????.php on line 5
the new script is :
<?php
require('functions.php');
if(!session_is_registered('loggedin'))
{
$pop=imap_open("{ your server:110/pop3}","user name ","your password");
}
//-----------------main part-------------------//
switch ($action)
{
###############################
// show a email //
###############################
case 'get_mail':
if(session_is_registered('loggedin'))
{$num=num();
if(isset($mail) and ($mail>0 and $mail<=$num))
{
/* get a message
.
.
.
.
*/
}
}
break;
###############################
// show all mail //
###############################
default:
$num=num();
switch ($num)
{
case -1:
/*--------//
.
.
.
show "you did fail"...........
.
.
.
//--------*/
break;
case 0:
session_register('loggedin');
$loggedin = 1;
$num_msg = 0;
/*--------//
.
.
.
show "you havent any emil in your inbox"...........
.
.
.
//--------*/
break;
default:
session_register('loggedin');
$loggedin = 1;
$num_msg=$num;
///-------------///
echo $num_msg;
///------------///
break;
}
break;
###############################
// end //
###############################
}
?>
and function source is:
<?php
function num()
{
if ($GLOBALS['pop'] == false)
return (-1);
else
{
if (($num_messages = @imap_num_msg($GLOBALS['pop'])) == 0)
{
return (0);
}
else
{
return($num_messages);
}
}
}
function inbox(........)
{
/*
.
.
.
*/
}
function get_mail(.......)
{
/*
.
.
.
*/
}
?>