Sending html email using Telnet, SMTP and Etisalat

We are a web designing company and we came to know that when we are sending some mail using the php mail function, the mail does not go to the recipent on time. so we developed a unique way so that the user gets the email as soon as it is sent.


$body = “<html><body><h1>hello world</h1></html>”;
$smtp_server = fsockopen(“”, 25, $errno, $errstr, 30);

   // We have an error, do something
   //echo “$errstr”;


 fwrite($smtp_server, “HELO its_me\r\n”);
  echo fgets($smtp_server);

  fwrite($smtp_server, “MAIL FROM:<>\r\n“);
  echo fgets($smtp_server);
  fwrite($smtp_server, “RCPT TO:<>\r\n“);
  echo fgets($smtp_server);
  fwrite($smtp_server, “DATA\r\n”);
  fwrite($smtp_server, “Subject: Feedback from $name!\r\n”);
  fwrite($smtp_server, “Mime-Version: 1.0;\r\n”);
  fwrite($smtp_server, “Content-Type: text/html; charset=ISO-8859-1;\r\n”);
  fwrite($smtp_server, “$body\r\n”);
  fwrite($smtp_server, “.\r\n”);
  fwrite($smtp_server, “.\r\n”);
  fwrite($smtp_server, “.\r\nQUIT\r\n”);



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s