Hi, I have created a class that sends an email via SMTP server. So far it works for text format. I want to upgrade it so it can send with Content-Type:text/html. I have tried this modified snippet ( I only paste some of my source to simplify the problem) :
if(fputs($this->pSocket,"DATA\r\n") < 0)
{ return false; }
$this->pLine = fgets($this->pSocket,1024);
$buffer = sprintf("From: %s\r\nTo: %s\r\nSubject: %s\r\n",$this->pFromName,$this->pToName,$this->pSubject);
if(fputs($this->pSocket,$buffer)<0)
{ return false; }
$mime = "MIME-Version: 1.0\r\n
Content-Type: text/html; charset=ISO-8859-1\r\n
Content-Transfer-Encoding: 7bit\r\n\r\n";
if(fputs($this->pSocket,$mime) < 0)
{ return false; }
if(fputs($this->pSocket,$this->pBody."\r\n\r\n")<0)
{ return false; }
if(fputs($this->pSocket,".\r\n")<0)
{ return false; }
$this->pLine = fgets($this->pSocket,1024);
but it didn't work. If anyone would like to help me, I will provide full source code.
Thanks for your attention