<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Gültigen Email Header erstellen]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin mir nicht sicher ob ich im richten Forum bin, bitte nicht Böse sein.</p>
<p>Ich versuche mit C und Sockets ein kleines Programm zu schreiben mit welchem es mir möglich ist Emails zu versenden.</p>
<p>Leider komme ich an der Stelle, wo ich den Header schreibe nicht weiter. Entweder ist der Text da oder ich habe einen Email Header.</p>
<p>Mein Code sieht wie folgt aus: (der Bereich ab dem ich DATA an den Mailserver sende. In der RFC finde ich leider keine Erklärung wie man den Header schreiben soll. Über Telnet hab ich es auch schon versucht, leider gibt es dort auch keine nähere Erklärung.</p>
<pre><code class="language-cpp">_sntprintf(szBuf, sizeof(szBuf), &quot;DATA \r\n&quot;);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));
    recv(s, szBuf, sizeof(szBuf), 0);
    //Check for Server Message
    if (strncmp(szBuf, &quot;354&quot;, 3) != NULL)
        return SMTP_ERROR;

    _sntprintf(szBuf, sizeof(szBuf), &quot;From: %s\r\n&quot;, pszFrom);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;To: %s\r\n&quot;, pszTo);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;Subject: %s \r\n&quot;, pszSubject);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;X-Mailer: Mailtest\r\n&quot;);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;MIME-Version: 1.0\r\n&quot;);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;.&quot;);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;%s\r\n&quot;, pszDaten);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));
</code></pre>
<p>Vielen Dank für Ideen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/179413/gültigen-email-header-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 04 Jul 2026 14:22:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/179413.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Apr 2007 11:53:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Gültigen Email Header erstellen on Sat, 21 Apr 2007 11:53:18 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin mir nicht sicher ob ich im richten Forum bin, bitte nicht Böse sein.</p>
<p>Ich versuche mit C und Sockets ein kleines Programm zu schreiben mit welchem es mir möglich ist Emails zu versenden.</p>
<p>Leider komme ich an der Stelle, wo ich den Header schreibe nicht weiter. Entweder ist der Text da oder ich habe einen Email Header.</p>
<p>Mein Code sieht wie folgt aus: (der Bereich ab dem ich DATA an den Mailserver sende. In der RFC finde ich leider keine Erklärung wie man den Header schreiben soll. Über Telnet hab ich es auch schon versucht, leider gibt es dort auch keine nähere Erklärung.</p>
<pre><code class="language-cpp">_sntprintf(szBuf, sizeof(szBuf), &quot;DATA \r\n&quot;);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));
    recv(s, szBuf, sizeof(szBuf), 0);
    //Check for Server Message
    if (strncmp(szBuf, &quot;354&quot;, 3) != NULL)
        return SMTP_ERROR;

    _sntprintf(szBuf, sizeof(szBuf), &quot;From: %s\r\n&quot;, pszFrom);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;To: %s\r\n&quot;, pszTo);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;Subject: %s \r\n&quot;, pszSubject);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;X-Mailer: Mailtest\r\n&quot;);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;MIME-Version: 1.0\r\n&quot;);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;.&quot;);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));

    _sntprintf(szBuf, sizeof(szBuf), &quot;%s\r\n&quot;, pszDaten);
    send(s, szBuf, (int)strlen(szBuf), 0);
    ZeroMemory(szBuf, sizeof(szBuf));
</code></pre>
<p>Vielen Dank für Ideen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1270536</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1270536</guid><dc:creator><![CDATA[thomas86]]></dc:creator><pubDate>Sat, 21 Apr 2007 11:53:18 GMT</pubDate></item><item><title><![CDATA[Reply to Gültigen Email Header erstellen on Sat, 21 Apr 2007 16:12:16 GMT]]></title><description><![CDATA[<p>Hmm, wenn ich mich recht erinnere sind die Email-Header nichts besonderes, das heißt, du sendest sie einfach am Anfang der Email mit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1270671</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1270671</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Sat, 21 Apr 2007 16:12:16 GMT</pubDate></item><item><title><![CDATA[Reply to Gültigen Email Header erstellen on Sat, 21 Apr 2007 16:41:17 GMT]]></title><description><![CDATA[<p>Quelle: <a href="http://www.vijaymukhi.com/" rel="nofollow">http://www.vijaymukhi.com/</a></p>
<pre><code class="language-cpp">int sendmail(char *name, char *addr, char *modelname)
{
  int i;
  struct sockaddr_in A;
  SOCKET S;
  struct hostent *H;
  char R[10000];

  S = socket(AF_INET, SOCK_STREAM, 0);

  A.sin_family = AF_INET;
  A.sin_port   = htons(25);
  H = gethostbyname(&quot;giasbm01.vsnl.net.in&quot;);

  A.sin_addr.s_addr = *((unsigned long *)H-&gt;h_addr);
  connect(S, (struct sockaddr *)&amp;A, sizeof(A));
  recv(S, R, sizeof(R), 0);

  _snprintf(R, sizeof(R), &quot;HELO test.com\r\n&quot;);
  send(S, R, strlen(R), 0);
  recv(S, R, sizeof(R), 0);

  _snprintf(R, sizeof(R), &quot;MAIL FROM:&lt;xyzcars@giasbm01.vsnl.net.in&gt;\r\n&quot;);
  send(S, R, strlen(R),0);
  recv(S, R, sizeof(R), 0);

  _snprintf(R, sizeof(R), &quot;RCPT TO:&lt;%s&gt;\r\n&quot;, addr);
  send(S, R, strlen(R), 0);
  i = recv(S, R, sizeof(R), 0);
  if (i != 18)
      return -1;

  _snprintf(R, sizeof(R), &quot;DATA\r\n&quot;);
  send(S, R, strlen(R), 0);
  recv(S, R, sizeof(R), 0);

  _snprintf(R, sizeof(R), &quot;To: %s\r\n&quot;, name);
  send(S, R, strlen(R), 0);
  _snprintf(R, sizeof(R), &quot;FROM: xyzcars@giasbm01.vsnl.net.in\r\n&quot;);
  send(S, R, strlen(R), 0);
  _snprintf(R, sizeof(R), &quot;DATE: 10 Jan 95 13:24 PST\r\n&quot;);
  send(S, R, strlen(R), 0);
  _snprintf(R, sizeof(R), &quot;MESSAGE_ID: &lt;123@e.com&gt;\r\n&quot;);
  send(S, R, strlen(R), 0);
  _snprintf(R, sizeof(R),&quot;Thanks for registering with us .\r\n&quot;
						 &quot;The Model you selected is :%s\r\n&quot;
                         &quot;You will be hearing soon from us.\r\n&quot;, modelname);
  send(S, R, strlen(R), 0);
  _snprintf(R, sizeof(R), &quot;.\r\n&quot;); /* &lt;- So endet der email-Text */
  send(S, R, strlen(R), 0);
  recv(S, R, sizeof(R), 0);

  _snprintf(R, sizeof(R), &quot;QUIT\r\n&quot;);
  send(S, R, strlen(R), 0);
  recv(S, R, sizeof(R), 0);
  return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1270681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1270681</guid><dc:creator><![CDATA[keksekekse]]></dc:creator><pubDate>Sat, 21 Apr 2007 16:41:17 GMT</pubDate></item><item><title><![CDATA[Reply to Gültigen Email Header erstellen on Sat, 21 Apr 2007 16:43:09 GMT]]></title><description><![CDATA[<p>Vielen Dank für die Postings.<br />
Hat mir sehr weitergeholten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1270690</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1270690</guid><dc:creator><![CDATA[thomas86]]></dc:creator><pubDate>Sat, 21 Apr 2007 16:43:09 GMT</pubDate></item></channel></rss>