digital-ether 399 Nearly a Posting Virtuoso Team Colleague

Thank you for your detailed reply. Now I want to know more about XMPP.

Can I implement this OpenFire Server with Apache, Mysql, and PHP?

Is there any tutorial for this? I am a beginner in developing field .So please guide me.

Best resource would be xmpp.org. The best way to look into XMPP is to setup your own server, such as an OpenFire server.

Then install one of the existing open source XMPP clients (IM client supporting XMPP) on your desktop.

Then you can view the traffic sent between the XMPP client and server using a tool such as Wireshark (formerly Ethereal).

You can test the XMPP protocol from the command line also. Look up the XMPP specification for the commands to send.

Here is an example of sending XMPP to google talk. http://www.adarshr.com/papers/xmpp

Can I implement this OpenFire Server with Apache, Mysql, and PHP?

Is there any tutorial for this? I am a beginner in developing field .So please guide me.

OpenFire server primarily sends XML over TCP conforming to the XMPP specification or other media such as video and audio streams under specifications such as RTMP.
Apache is a webserver and primarily sends HTML over HTTP conforming to the HTML specifications.
So the two are separate and for different purposes. There are specifications such as BOSH which allows XMPP over HTTP, but I'm not sure if Apache is the best tool.

In other words, OpenFire runs by …

digital-ether 399 Nearly a Posting Virtuoso Team Colleague

You can validate email addresses before actually sending emails.

First you can validate the syntax. That is check if the email address is of valid format.

Then you can try validation via SMTP:
http://code.google.com/p/php-smtp-email-validation/

As for validation within emails, to see if they were opened, you can embed images that are actually PHP files.

eg:

<img src="http://yoursite.com/validate.php?id=emailid" />

Then have the php page http://yoursite.com/validate.php log the opening of the email.

However, some email clients will disable images by default.

If you use JavaScript, it will most likely not work.

digital-ether 399 Nearly a Posting Virtuoso Team Colleague

now, IIS does not have something to do with that(Directory Listing Denied) because I myself have IIS and WAMP installed and running at the same time but on different port and even though they are running on the same port, that's not the error that is expected.....

The message "Directory Listing Denied" is specific to IIS.

Apache gives the message:

Forbidden

You don't have permission to access / on this server.

Neither of these are error messages. They occur when a webserver is configured to disallow directory indexes. (ie: you do not want to display your directory structure)

It is just a coincidence that IIS is configured this way, and it looks like an error. The actual problem with Apache is unrelated to the IIS message. But the message does show that IIS is using port 80 on the localhost. This causes Apache to fail on startup.

You should find the error message in the Apache logs. It should say that Apache failed to bind to the network address, and then it should have a "Stopping Service" message or something similar.

At this point you cannot tell if WAMP installed successfully, that is also unrelated to the IIS message. It is most likely that WAMP installed successfully, but only Apache cannot start, since IIS is using port 80 on localhost.

I think the best option is to figure out if WAMP installed successfully or not.

If WAMP installed, it should create icons depending on …

digital-ether 399 Nearly a Posting Virtuoso Team Colleague

Hey Guys,

I've updated the SMTP_validateEmail class with better email address parsing, and it can now validate multiple emails on the same domain via a single socket connection for efficiency.

Also added is support for Windows clients, which requires Net_DNS.
http://pear.php.net/package/Net_DNS

<?php
 
 /**
 * Validate Email Addresses Via SMTP
 * This queries the SMTP server to see if the email address is accepted.
 * @copyright http://creativecommons.org/licenses/by/2.0/ - Please keep this comment intact
 * @author gabe@fijiwebdesign.com
 * @contributers adnan@barakatdesigns.net
 * @version 0.1a
 */
class SMTP_validateEmail {

 /**
  * PHP Socket resource to remote MTA
  * @var resource $sock 
  */
 var $sock;

 /**
  * Current User being validated
  */
 var $user;
 /**
  * Current domain where user is being validated
  */
 var $domain;
 /**
  * List of domains to validate users on
  */
 var $domains;
 /**
  * SMTP Port
  */
 var $port = 25;
 /**
  * Maximum Connection Time to an MTA 
  */
 var $max_conn_time = 30;
 /**
  * Maximum time to read from socket
  */
 var $max_read_time = 5;
 
 /**
  * username of sender
  */
 var $from_user = 'user';
 /**
  * Host Name of sender
  */
 var $from_domain = 'localhost';
 
 /**
  * Nameservers to use when make DNS query for MX entries
  * @var Array $nameservers 
  */
 var $nameservers = array(
	'192.168.0.1'
);
 
 var $debug = false;

 /**
  * Initializes the Class
  * @return SMTP_validateEmail Instance
  * @param $email Array[optional] List of Emails to Validate
  * @param $sender String[optional] Email of validator
  */
 function SMTP_validateEmail($emails …
digital-ether 399 Nearly a Posting Virtuoso Team Colleague

I'm at a net cafe right now so I can't test the class, but a few things after looking at it a bit more:

1) The emails are separated into user and domain portions using explode('@', $email); I remember reading that @ can occur in email username portion if escaped with a backslash, or quoted.

But since domains cannot have @ in them, I think explode() would work by taking the last piece as the domain, and the remaining as the email.

function setEmail($email) {
		$parts = explode('@', $email);
		$this->domain = array_pop($parts);
		$this->user= implode('@', $parts);
	}

2) The class opens and closes a socket connection to the MTA on each email it validates. Maybe a grouping of emails on the same host could keep the socket alive, and just issue RCPT commands to the open connection? Not even sure if that is supported by SMTP?

I'll see what I can do when I get to a development machine.

digital-ether 399 Nearly a Posting Virtuoso Team Colleague

Beautiful... :)

digital-ether 399 Nearly a Posting Virtuoso Team Colleague

Hi tgbyhn,

Thanks for making those fixes.

Theres a bit of guessing in that class, in the reading from the socket.

The class currently reads from the socket between client and MTA in non-blocking mode.

socket_set_blocking($this->sock, false);

It tries to read from the socket until it receives a few bytes, and will finish reading until that stream is done.

function send($msg) {
		fwrite($this->sock, $msg."\r\n");

		$resp = '';
		$start = $this->microtime_float();
		while(1) {
			$reply = fread($this->sock, 2082);
			$resp .= $reply;
			if (($resp != '' && trim($reply) == '') 
			|| ($this->microtime_float() - $start > $this->max_read_time )) {
				break;
			}
		}

		$this->debug(">>>\n$msg\n");
		$this->debug("<<<\n$resp");
		
		return $resp;
	}

The timer:

$this->microtime_float() - $start > $this->max_read_time )

makes sure it doesn't keep reading for ever.

I'd think there is a better way to do this, a more standard way? maybe one defined in the SMTP specs?

Is there a delimiter to wait for when making a read, to know the MTA has finished the response?

At the moment, if the MTA doesn't respond before SMTP_validateEmail::max_read_time then the read will stop, and nothing will be received.

I started with having reads in blocking mode, but with hotmail it hanged on the first read? Maybe it was due to not reading the HELO first, and now that you're updated that reading in blocking mode should work with all MTAs?

edit: Do you think using the "verify" command before trying 'RCPT TO' would be more polite and should give less chance …

digital-ether 399 Nearly a Posting Virtuoso Team Colleague

Some companies do not like such access and will report it is a cracking attempt. Maybe it's not as big an issue as it was several years ago, but there are ignorant companies out there. I didn't understand it either, but obviously it happens.

Well, sorry that happened to you.

digital-ether 399 Nearly a Posting Virtuoso Team Colleague

Be careful with connecting to random/unknown hosts. It can get you into legal trouble. Just a warning, since it happened to me...

I don't see how you could get into any legal issues for connecting to an SMTP server to ask if an email exists, given that the email address you want to query is solicited and not spam?