Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,420 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,984 people online right now. Registration is fast and FREE... Join Now!




Sending mail using c

 
Reply to this topicStart new topic

Sending mail using c

francisprite
19 Jan, 2008 - 03:23 AM
Post #1

New D.I.C Head
*

Joined: 19 Jan, 2008
Posts: 1

I'm trying to retrieve th QUERY_STRING in the url but it contains all sorts of things. I think I'm supposed to manipulate the string to get whatever I need but that has a lot of problems, like the " " characters turning into "+" signs. I feel that I need to do something before the inputs are sent using SUBMIT.

here's my code (at least all what I've written to get the inputs before I really get to send mail using system(mailx)):
CODE

#include <stdio.h>
#nclude <stdio.h>
#include <stdlib.h>

int main()
{
        getenv("QUERY_STRING");
        printf("content-type: text/html\n\n");
        printf("<html>\n");
        printf("<body>\n");
        printf("<form method=\"get\" action=\"/srv/www/cgi-bin/200739419/mp1.cgi\" name=\"\">\n");
        printf("<table border=\"1\" cellspacing=\"1\" cellpading=\"1\">\n");
        printf("<tr>\n");
        printf("<td align=\"left\">From:</td>\n");
        printf("<td align=\"center\"><input name=\"From\" size=\"41\" maxlength=\"100\"></td>\n");
        printf("</tr>\n");
        printf("<tr>\n");
        printf("<td align=\"left\">To:</td>\n");
printf("<td align=\"center\"><input name=\"To\" size=\"41\" maxlength=\"100\"></td>\n");
        printf("</tr>\n");
        printf("<tr>\n");
        printf("<td align=\"left\">Subject:</td>\n");
        printf("<td align=\"center\"><input name=\"Subject\" size=\"41\" maxlength=\"100\"></td>\n");
        printf("</tr>\n");
        printf("<tr>\n");
        printf("<td align=\"left\" colspan=\"2\">Message:</td>\n");
        printf("</tr>\n");
        printf("<tr>\n");
        printf("<td align=\"center\" colspan=\"2\" height=\"200\"><textarea name=\"Message\" rows=\"12\" cols=\"52\" maxlenght=\"250\"></textarea></td>\n");
        printf("</tr>\n");
        printf("</table>\n");
        printf("<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\n");
        printf("<tr>\n");
        printf("<td colspan=\"165\">\n");
        printf("</td>\n");
        printf("<td>\n");
printf("</tr>\n");
        printf("</table>\n");
        printf("</form>\n");
        printf("</body>\n");
        printf("</html>\n");
        return 0;
}

User is offlineProfile CardPM
+Quote Post

Nayana
RE: Sending Mail Using C
19 Jan, 2008 - 04:41 AM
Post #2

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
I'm not sure of your exact problems...

But when an HTML form is submitted using GET, the spaces should become plus signs. It is up to the server looking at the GET data to turn the "+"s back into " "s.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/5/08 04:27AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month