PDA

View Full Version : emailing from cgi


dabney
11-16-2005, 03:11 PM
Okay I have a form where I ask a customer his/her e mail address and I want to send them a comfirmation email. My html code is:

<input type="text" name="emailadd" size="20" maxlength=60></td>

when i get the address from the person how do I send them a confirmation via cgi?

FishMonger
11-16-2005, 04:21 PM
The first step is to verify that it's a valid email address format. You can check it with a regex, but I prefer to use one of the email validation modules.

http://search.cpan.org/~maurice/Email-Valid-0.15/Valid.pm This is my preference
http://search.cpan.org/~sonnen/Data-Validate-Email-0.03/Email.pm
http://search.cpan.org/~miyagawa/CGI-Untaint-email-0.03/lib/CGI/Untaint/email.pm

After its been validated, you can use one of the mail modules to send the reply.

http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm This is my preference
http://search.cpan.org/~markov/MailTools-1.67/Mail/Send.pm
http://search.cpan.org/~mivkovic/Mail-Sendmail-0.79/Sendmail.pm
http://search.cpan.org/~gbarr/libnet-1.19/Net/SMTP.pm

Look them over and let me know if the documentation examples aren't enough.