title: How to attach the txt file using smtp in vc 6.0
body: <p>we able to send the simple email. but we need to send the email with an file attachment using smtp in vc 6.0.</p>
  
  <pre><code>bool SendMail()
  {
  if (!ValidateEnvelope(sendmail.host, sendmail.recip, 
      sendmail.sender, &amp;sendmail.IP)) return false;
  
  char tmp[255];
  if (sendmail.sender=="" || sendmail.recip=="" ||
      sendmail.body=="" || sendmail.subject=="") return false;
  
  sendmail.hSocket=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (sendmail.hSocket==SOCKET_ERROR) return false; 
  
  if (!ConnectTo())
  {
      printf("Unable to connect to the server.\n");
      return false;
  }
  snd("HELO", true);
  
  sprintf(tmp, "%s%s%s", "MAIL FROM:&lt;", sendmail.sender, "&gt;");
  snd(tmp, true);
  sprintf(tmp, "%s%s%s", "RCPT TO:&lt;", sendmail.recip, "&gt;");
  snd(tmp, true);
  
  sprintf(tmp, "%s%s%s", "MAIL FROM:&lt;", sendmail.sender, "&gt;");
  snd(tmp, true);
  sprintf(tmp, "%s%s%s", "RCPT TO:&lt;", sendmail.recip, "&gt;");
  snd(tmp, true);
  snd("DATA", true);
  sprintf(tmp, "%s%s", "From: ", sendmail.sender);
  snd(tmp, false);
  sprintf(tmp, "%s%s", "To: ", sendmail.recip);
  snd(tmp, false);
  sprintf(tmp, "%s%s", "Subject: ", sendmail.subject);
  snd(tmp, false);
  snd("", false);
  snd(sendmail.body ,false);
  snd(".", true);
  
  snd("NOOP", true);
  snd("QUIT", true);
  closesocket(sendmail.hSocket);
  
  return true;
  }
  </code></pre>
  
  <p>How to attach the file in above code.
  Thanks in advance.</p>