I have an HTML form that currently takes the inputs and sends them out in an email with HTML formatting, so that the email looks basically like the form webpage, but with all of the fields filled in.
<form method="post" action="/cgi-bin/perlscript.pl" enctype="x-www-form-encoded" name="Form">
<input type="text" name="txtMyText" id="txtMyText" />
</form>
The post-action script is written in Perl, and I am currently converting it to C++ simply because it is much easier for me to read and maintain that way. Also, I think it is more flexible for future additions.
In Perl, I was able to use “SendMail” to send the email, and I could do something like this:
sub PrintStyles
{
print MAIL <<ENDMAIL
<html>
<head>
<style>
h1.title { color: Red; }
h3.title { color : Black; background-color: yellow; }
</style>
<!-- Put any valid HTML here that you want -->
<!-- You can even put variables ($xxxx) into the HTML as well, like this: -->
<td>$myVariable</td>
ENDMAIL
}
What was nice about that, was I could literally copy-and-paste my entire CSS and HTML files (very lengthy) as long as they were in-between the “ENDMAIL” tags, and they would show up perfectly. I could even put the variables in there without having to do any extra work.
My questions is: Is there a C++ library that has similar functionality? I really don’t think I can afford to do something like this:
cout << "<html>" << endl;
cout << "<head>" << endl;
cout << "......" << endl;
I’d like it to be fairly light-weight.
Thanks.
Thank you all for the responses. I have decided to simply call the Perl script from my code, and send the response data as an argument. I know it’s probably not the best solution, but I don’t think my C++ options were worth it.