C form request mail
Here is an example of a form request email in C:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_NAME 50
#define MAX_EMAIL 50
#define MAX_MESSAGE 200
int main() {
char name[MAX_NAME];
char email[MAX_EMAIL];
char message[MAX_MESSAGE];
printf("Enter your name: ");
fgets(name, MAX_NAME, stdin);
name[strcspn(name, "\n")] = 0; // remove newline character
printf("Enter your email: ");
fgets(email, MAX_EMAIL, stdin);
email[strcspn(email, "\n")] = 0; // remove newline character
printf("Enter your message: ");
fgets(message, MAX_MESSAGE, stdin);
message[strcspn(message, "\n")] = 0; // remove newline character
FILE *fp = fopen("form_request.txt", "w");
if (fp == NULL) {
printf("Error opening file\n");
return 1;
}
fprintf(fp, "Name: %s\n", name);
fprintf(fp, "Email: %s\n", email);
fprintf(fp, "Message: %s\n", message);
fclose(fp);
printf("Form request sent successfully\n");
return 0;
}
This program will prompt the user to enter their name, email, and message. It will then write this information to a file named "form_request.txt". The file will be created in the same directory as the program.
Please note that this is a very basic example and does not include any error checking or validation of the user's input. In a real-world application, you would want to add this to ensure that the program is robust and secure.