basura

Hi there, as i suppose, there is not a

PHP

  Class that could allow to a server read SMTP messages from an incoming account to verify the link that receives.

For example, if you sign up into a forum, inmediatly the script sends a link to verify that you are the right person with a link that you must click.

There is any script -cURL

php

  Class- that allow making this automatically?

Please help me on finding something similar...

PS:

Im still waiting for the auto account email generator (Yahoo, Hotmail, GMail...) If anyone have it too.... Applause

Thanks in advance,aka SlimeLORD

perkiset

I'm confused SLord - are you saying you actually want to *receive* the messages that are sent to verify that you are a real person?

If that is the case, then you need POP3 or IMAP, not SMTP. I use a class called, cleverly, "imapMail" from an author named Harish Chauhan. I modified it just a bit to do some things that I wanted to do, but out of the box his class will do what you need. I chose IMAP rather than POP3 because the possibility of a server getting corrupted with large amounts of undelivereds is higher. (Jeepers, why would THAT ever happen?  :Applause )

Here is a small snippet of code that would demonstrate using his class. It is available at

PHP

  Classes, or a quick google of "

php

  imap class harish" will do you.


<?

php

 

$imap = new imapMail;
$userName = 'someuser';
$password = 'apassword';
$host = 'mail.perkiset.org';

if (!$imap->open($aHost))
die("emailRetriever cannot connect to $host");

$imap->login($userName, $password);
if ($imap->error)
die("emailRetriever died connecting as $userName: {$imap->error}");

$imap->open_mailbox('INBOX');
if ($imap->error)
die("emailRetriever died opening INBOX as $userName: {$imap->error}");

// OK - we're in.. get any messages, flag them for delete and close up...
$msgCount = $imap->get_msglist();

while ($msgCount > 0)
{
$buffer = mysql_escape_string($imap->get_message($msgCount));

// do something with $buffer - I write it to a DB for later handling

$imap->delete_message($msgCount);
$msgCount--;

}

$imap->close_mailbox();

?>

JasonD

quote
If that is the case, then you need POP3 or IMAP, not SMTP


Without being a huge technical bore you <>can do it using the SMTP protocol but it would be extremely unusual for that to happen these days.

Many eons ago, when the (what was then) the largest UK ISP Demon was set up it decided to give everyone a host under it's main domain demon.co.uk - All email was transferred to you using SMTP and that could still be the case now

ratthing

Rather than thinking of it in terms of the protocol, SMTP, think of it in terms of MUA or MTA.  Sendmail, postfix, and exim are all MTAs, <>mail transfer agents.  What you want to do is access and manipulate mail that's already been delivered, for this you need a MUA, or <>mail user agent.  The simplest tool I know of to deal with manipulating remote mail to get it to a local spool file is fetchmail (if you're on UNIX).  At that point the mail is in a file on your local

mac

 hine.

You could use procmail, which includes a ton of filtering options, and could be used to trigger scripts, even.

I'm always mindful to remember the UNIX way...lots of small tools strung together to do more powerful things...why reinvent the wheel?
There's

perl

  modules built do mail fetching and manipulation, I know.  I'd think there's likely a

PHP

  class library.

=RT=

vsloathe

I can't be arsed to find it, but yeah there's a large

PEAR

 /PECL module for it as well as several smaller more lightweight

PHP

  libs. Parse out the links from the email with

regex

  or whatever. Some places like myspace send their emails base64 encoded so you need to decode base64 at times but that's like a single line of code to call another prewritten lib (been done tons of times already as well).


Perkiset's Place Home   Politics @ Perkiset's