Page 1 of 1
POP3
Posted: Tue Apr 06, 2004 9:40 am
by marce23
Hi
Does anyone know, how i´m able to connect to a pop3-server and display my new mails in my own HTML-style???
thx
marce23
Posted: Tue Apr 06, 2004 9:53 am
by liljester
if you want to learn network programming with php it would be a fun project to create a mail application... if you just want a quick way to do it, you should prolly find a free php email script. i think ive seen squirrelmail mentioned on this forum before
Posted: Tue Apr 06, 2004 9:54 am
by ol4pr0
Code: Select all
<?
// connecting to a pop3 /imap
$mail = imap_open('{mail.server.com:143}', ' username' , 'password' ); //imap
$mail = imap_open(' {mail.server.com/pop3}', ' username' , 'password'); //pop3
$headers = imap_headers($mail); // get mail headers
$last = imap_num_msg($mail);
$header = imap_header($mail, $last);
$body = imap_body($mail, $last); // grap body
imap_clode($mail); // closing connection
?>
hope this will help
Posted: Tue Apr 06, 2004 10:04 am
by marce23
I´ve a problem
If i type at ??? pop3.web.de
$mail = imap_open('{???}', '' , '' ); //imap
$mail = imap_open(' {???}', '' , ''); //pop3
I get these Error:
Fatal error: Call to undefined function: imap_open() in D:\Programme\Apache Group\Apache2\htdocs\mail\mail.php on line 4
Posted: Tue Apr 06, 2004 10:45 am
by marce23
What have i to put into the ???-field
Mail Server:
imap.web.de
smtp.web.de
pop3.web.de
marce23
Posted: Tue Apr 06, 2004 10:51 am
by magicrobotmonkey
its not a problem with the ??? field. Look at the error maybe you're missing a module or something.
Posted: Tue Apr 06, 2004 11:38 am
by marce23
<?php
$connection = fsockopen('pop3.server.de',110);
if($connection)
{
echo fgets($connection);
fputs($connection,'USER yourusername\r\n');
echo fgets($connection);
fputs($connection,'PASS yourpassword\r\n');
echo fgets($connection);
fputs(connection,'LIST\r\n');
echo fgets($connection);
fputs(connection,'QUIT\r\n');
echo fgets($connection);
fclose($connection);
}
?>
<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>!!!:
+OK WEB.DE POP3-Server
Fatal error: Maximum execution time of 30 seconds exceeded in D:\Programme\Apache Group\Apache2\htdocs\new.php on line 8
Posted: Tue Apr 06, 2004 2:55 pm
by ol4pr0
did you build youre php with
#--with-imap or --with-imap-ssl and if with a self-made certificate add this aswell..
/novalidate-cert
###
Than try the following again..
Code: Select all
<?
// connecting to a pop3 /imap
// imap connection....
$mail = imap_open('{mail.server.com:143}', ' username' , 'password' );
// for pop3
$mail = imap_open(' {mail.server.com/pop3}', ' username' , 'password');
$headers = imap_headers($mail); // get mail headers
$last = imap_num_msg($mail);
$header = imap_header($mail, $last);
$body = imap_body($mail, $last); // grap body
imap_clode($mail); // closing connection
?>
Posted: Tue Apr 06, 2004 3:14 pm
by Steveo31
The error means the imap_open is an undefined function, just in case someone was confused. So like they said, you need to install the ... somethin... to get it to be recognized.