PDA

View Full Version : Any way to send a form automatically to a user-chosen email?


beaastiebabe
01-01-2012, 07:31 PM
I want the user to be able to type in an email, then fill out the rest of the form, then have the form data automatically be sent to that email. Is this possible??

Ricky55
01-01-2012, 07:54 PM
Of course. Just make the recipient equal the contents of the email field. Might be a more elegant way but that would work. May want to use captcha to help prevent spammers though.


$recipient = $_POST['email'];


http://www.captcha.net/

beaastiebabe
01-01-2012, 09:05 PM
What about the script?

The FormMail.pl

Here it is (part of it):


BEGIN
{
$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 5;
$mailprog = '/usr/lib/sendmail -oi -t';
$postmaster = '';
@referers = qw(website.org www.website.org);
@allow_mail_to = qw(email@email.com);
@recipients = ();
%recipient_alias = ();
@valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
$locale = '';
$charset = 'iso-8859-1';
$date_fmt = '%A, %B %d, %Y at %H:%M:%S';
$style = '/css/nms.css';
$no_content = 0;
$double_spacing = 1;
$wrap_text = 0;
$wrap_style = 1;
$address_style = 0;
$send_confirmation_mail = 0;
$confirmation_text = <<'END_OF_CONFIRMATION';


ps: I changed the URL & email for privacy ^.^

edbr
01-01-2012, 11:56 PM
edit this line to the vars ricky55 gave you. $recipient

@allow_mail_to = qw(email@email.com);

Ricky55
01-02-2012, 02:30 AM
Sorry I assumed you had the script.