📄 mailgen.c
字号:
/* Generic Email Send Page Generator */#include <stdio.h>#include <stdlib.h>main(int argc, char *argv[]){/* This variable stores the logical target of the email. */ char *target;/* Retrieve the logical target from the environment. */ target=(char *)getenv("PATH_INFO");/* Send the content type header to the server. */ printf("Content-type: text/html%c%c",10,10);/* Generate the email send HTML 3.0 page for the logical target. */ printf("<HTML>%c<HEAD>%c",10,10);/* If an empty target is specified, generate an error message. */ if((!target) || (!target[0])){ printf("<TITLE>%s Error Screen</TITLE>%c</HEAD>%c<BODY>%c",*argv,10,10,10); printf("<STRONG>Invalid User Name.</STRONG>%c",10); printf("</BODY>%c</HTML>%c",10,10); exit(1); }/* Make sure a GET request was used to call this CGI application. */ if(strcmp(getenv("REQUEST_METHOD"),"GET")) { printf("<TITLE>%s Error Screen</TITLE>%c</HEAD>%c<BODY>%c",*argv,10,10,10); printf("This script should be referenced with a METHOD of GET.\n"); printf("</BODY>%c</HTML>%c",10,10); exit(2); }/* If all is well, generate the head element of the send page. */ printf("<TITLE>Email Page for %s</TITLE>%c",target+1,10); printf("</HEAD>%c",10);/* Begin the body element of the document. */ printf("<BODY>%c<HR>%c",10,10);/* Generate heading of send page. */ printf("<H1 ALIGN=\"center\" DINGBAT=\"mail\">"); printf("Mail Page for %s</H1>%c",target+1,10); printf("<HR SIZE=5>%c",10);/* Place form for mail message input. */ printf("<FORM METHOD=\"POST\" ACTION=\"/cgi-bin/mailsend\" ENCTYPE=\\"application/x-www-form-urlencoded\">%c",10);/* Include logical target as a hidden input item. */ printf("<INPUT TYPE=\"hidden\" NAME=\"destination\" VALUE=\"%s\">%c", target+1,10); printf("Your Name: <INPUT TYPE=\"text\" SIZE=40 NAME=\"name\"><BR>%c",10,10); printf("Return Address:"); printf("<INPUT TYPE=\"text\" SIZE=40 NAME=\"address\"><BR>%c",10); printf("Subject:"); printf("<INPUT TYPE=\"text\" SIZE=40 NAME=\"subject\"><BR>%c",10); printf("Your Message: <BR><TEXTAREA COLS=60 ROWS=10 NAME=\"message\">%c",10); printf("Replace this with your own message.%c</TEXTAREA><BR>%c",10,10); printf("<INPUT TYPE=\"reset\" VALUE=\"Clear Entries\">%c",10,10); printf("<INPUT TYPE=\"submit\" VALUE=\"Send Mail\">%c",10); printf("</FORM>%c",10);/* Signature of contact info for web based email administration. */ printf("<HR>%c<H6>Page Generated Automatically, contact David Kerven"); printf("(dsk@cau.auc.edu) with any questions.</H6>%c",10); printf("</BODY>%c</HTML>%c",10,10); exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -