Hey seen I am mentioning the important part of the code that you have to insert, and some libraries that you have to insert on your own, and don’t worry that is too simple. Though this lines you can simply gives some authentication to your application.
Code:
Function MailMsg (const char *headline, const char *story, char *user id, char* WAU)
{
if ((NULL == headline) || (NULL == story) || (user id == NULL))
{
printf ("Unable to send the message due to error in msg.<br>\n");
return Failure;
}
FILE *mail;
char *email = NULL, *where;
if (NULL == (where = strchr (user id, '|')))
{
printf ("not able to discover bar delimiter in userid.<br>\n");
return Failure;
}
COPYSTRING (email, &(where[1]))
where[0] = '\0';
if (0 == strcmp ("Everyone", email))
return MailToEveryone (headline);
if (NULL != (mail = popen ("/usr/sbin/sendmail -t", "w")))
{
fprintf (mail, "To: %s <%s>\n", id, email);
fprintf (mail, "From: %s @ Message Board\n",WAU);
fprintf (mail, "Subject: %s\n", headline);
fprintf (mail, "\n");
fprintf (mail, "You have a message waiting\n");
fprintf (mail, "\n.\n");
pclose (mail);
return Success;
}
printf ("not able to begin sendmail.<br>\n");
return Failure;
}
Bookmarks