FRESHERSHOME
Freshers Forum

Php email service providing?

This is a discussion on Php email service providing? within the PHP forums, part of the Languages category; Hi, How to create php email service...


Go Back   Jobs in India Forum > Programming > Languages > PHP

Notices

PHP PHP Discussion Forum, PHP Configuration, PHP help, etc

 
Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2008, 07:48 PM
YahooHoo
 
Join Date: Jan 2008
Posts: 1
Default Php email service providing?

Hi,
How to create php email service
__________________
Powered by Yahoo!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 01-13-2008, 07:48 PM
YahooHoo
 
Join Date: Jan 2008
Posts: 1
Default

<?
/* Pop3 Functions.
Smtp Functions. [Added later, going to split]

For a real example take a look at:
http://www.javaorigin.com

I have just started to explore the world of PHP3,
so excuse (and correct me if I'm doing something wrong.

Unk. (rgroesb@triple-it.nl)
*/

function pop3_open($server, $port)
{
global $POP3_GLOBAL_STATUS;

$pop3 = fsockopen($server, $port);
if ($pop3 <= 0) return 0;

$line = fgets($pop3, 1024);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

return $pop3;
}

function pop3_user($pop3, $user)
{
global $POP3_GLOBAL_STATUS;

fputs($pop3, "USER $user\r\n");
$line = fgets($pop3, 1024);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

return 1;
}

function pop3_pass($pop3, $pass)
{
global $POP3_GLOBAL_STATUS;

fputs($pop3, "PASS $pass\r\n");
$line = fgets($pop3, 1024);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

return 1;
}

function pop3_stat($pop3)
{
global $POP3_GLOBAL_STATUS;

fputs($pop3, "STAT\r\n");
$line = fgets($pop3, 1024);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

if (!eregi("+OK (.*) (.*)", $line, $regs))
return 0;

return $regs[1];
}

function pop3_list($pop3)
{
global $POP3_GLOBAL_STATUS;

fputs($pop3, "LIST\r\n");
$line = fgets($pop3, 1024);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

$i = 0;
while (substr($line = fgets($pop3, 1024), 0, 1) <> ".")
{
$articles[$i] = $line;
$i++;
}
$articles["count"] = $i;

return $articles;
}

function pop3_retr($pop3, $nr)
{
global $POP3_GLOBAL_STATUS;

fputs($pop3, "RETR $nr\r\n");
$line = fgets($pop3, 1024);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

while (substr($line = fgets($pop3, 1024), 0, 1) <> ".")
{
$data[$i] = $line;
$i++;
}
$data["count"] = $i;

return $data;
}

function pop3_dele($pop3, $nr)
{
global $POP3_GLOBAL_STATUS;

fputs($pop3, "DELE $nr\r\n");
$line = fgets($pop3, 1024);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;


return 1;
}

function pop3_quit($pop3)
{
global $POP3_GLOBAL_STATUS;

fputs($pop3, "QUIT\r\n");
$line = fgets($pop3, 1024);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] = substr($line, 0, 1);
$POP3_GLOBAL_STATUS[$pop3]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($POP3_GLOBAL_STATUS[$pop3]["LASTRESULT"] <> "+") return 0;

return 1;
}

function smtp_open($server, $port)
{
global $SMTP_GLOBAL_STATUS;

$smtp = fsockopen($server, $port);
if ($smtp < 0) return 0;

$line = fgets($smtp, 1024);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] = substr($line, 0, 1);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] <> "2") return 0;

return $smtp;
}


function smtp_helo($smtp)
{
global $SMTP_GLOBAL_STATUS;

/* 'localhost' always works [Unk] */
fputs($smtp, "helo localhost\r\n");
$line = fgets($smtp, 1024);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] = substr($line, 0, 1);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] <> "2") return 0;

return 1;
}

function smtp_ehlo($smtp)
{
global $SMTP_GLOBAL_STATUS;

/* Well, let's use "helo" for now.. Until we need the
extra func's [Unk]
*/
fputs($smtp, "helo localhost\r\n");
$line = fgets($smtp, 1024);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] = substr($line, 0, 1);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] <> "2") return 0;

return 1;
}


function smtp_mail_from($smtp, $from)
{
global $SMTP_GLOBAL_STATUS;

fputs($smtp, "MAIL FROM: <$from>\r\n");
$line = fgets($smtp, 1024);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] = substr($line, 0, 1);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] <> "2") return 0;

return 1;
}

function smtp_rcpt_to($smtp, $to)
{
global $SMTP_GLOBAL_STATUS;

fputs($smtp, "RCPT TO: <$to>\r\n");
$line = fgets($smtp, 1024);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] = substr($line, 0, 1);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] <> "2") return 0;

return 1;
}

function smtp_data($smtp, $subject, $data)
{
global $SMTP_GLOBAL_STATUS;

fputs($smtp, "DATA\r\n");
$line = fgets($smtp, 1024);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] = substr($line, 0, 1);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] <> "3") return 0;

fputs($smtp, "Mime-Version: 1.0\r\n");
fputs($smtp, "Subject: $subject\r\n");
fputs($smtp, "$data\r\n\r\n");
fputs($smtp, ".\r\n");
$line = fgets($smtp, 1024);
if (substr($line, 0, 1) <> "2")
return 0;

return 1;
}

function smtp_quit($smtp)
{
global $SMTP_GLOBAL_STATUS;

fputs($smtp, "QUIT\r\n");
$line = fgets($smtp, 1024);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] = substr($line, 0, 1);
$SMTP_GLOBAL_STATUS[$smtp]["LASTRESULTTXT"] = substr($line, 0, 1024);

if ($SMTP_GLOBAL_STATUS[$smtp]["LASTRESULT"] <> "2") return 0;

return 1;
}



/*
$pop3 = pop3_open("localhost", "110");
if (!$pop3) {
printf("[ERROR] Failed to connect to localhost<BR>\n");
return 0;
}

if (!pop3_user($pop3, "unk")) {
printf("[ERROR] Username failed!<BR>\n");
return 0;
}

if (!pop3_pass($pop3, "secret")) {
printf("[ERROR] PASS failed!<BR>\n");
return 0;
}

$articles = pop3_list($pop3);
if (!$articles) {
printf("[ERROR] LIST failed!<BR>\n");
return 0;
}

for ($i = 1; $i < $articles ["count"] + 1; $i++)
{
printf("i=$i<BR>\n");
$data = pop3_retr($pop3,$i);
if (!$data) {
printf("data goes wrong on '$i'<BR>\n");
return 0;
}

for ($j = 0; $j < $data["count"]; $j++)
{
printf("$data[$j]<BR>\n");
}
}
*/


?>
__________________
Powered by Yahoo!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
php

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Sitemap
Jobs by Location: Advertising and Marketing Jobs - IT Software Jobs - Walk-in Jobs - BPO Jobs - Government Jobs - Sales / BD Jobs - Tele Communication Jobs App Programming - Network Admin

Jobs By Location: Jobs in Bangalore - Jobs In India - Jobs in Delhi - Jobs in Hyderabad - Jobs in Kochi - Jobs in Mumbai - Jobs in Trivandrum - Jobs in pune - Jobs in Jonida - Jobs in Chennai - Jobs in Coimbator

Jobs Type: Full Time Jobs - Part Time Jobs
Latest Jobs - Accounting Jobs - Engineering Jobs - IT Jobs - Walkins - How to Face Interview - HR Round Tips - Career Info - Guide For Freshers - Apply for Jobs - Future Studies - Jobs Forums - Freshers IT Software Salary Details


All times are GMT +6.5. The time now is 06:32 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
FreshersHome.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62