# MAIL-A-LINK info # if set to TRUE, mail-a-link will be displayed during img display my $mail_a_link = 'TRUE'; # location of sendmail binary my $sendmail = '/usr/bin/sendmail'; # message to send as body of mail # placeholders for use in body: # <: sender_name :> - name of the person who requested the email # <: image_link :> - link being emailed # <: image_name :> - name of the image my $mail_body = <, who thinks you would enjoy this image:
<:image_name:> at <:image_link:>

Feel free to stop by and have a look around.
Thank you,
$default_title EOD # /* ------------------------------------------------------------------- */ # linkmail # /* ------------------------------------------------------------------- */ sub linkmail { my $img_name = $img_lst[$curr_img_num] || &idx(); my($status, $to_name, $to_email, $from_name, $from_email) = ('')x5; if (($to_name = $cgi->param('to_name')) && ($to_email = $cgi->param('to_email')) && ($from_email = $cgi->param('from_email')) && ($from_name = $cgi->param('from_name'))) { $status = "\nERR: Invalid character in Recipient's name : $to_name
" unless $to_name =~ /^[\w\.\'\s]+$/; $status .= "\nERR: Malformed email address for Recipient : $to_email
" unless $to_email =~ /^[\w\-\.]+\@[\w\-\.]+\.\w+$/; $status .= "\nERR: Invalid character in Your name : $from_name
" unless $from_name =~ /^[\w\.\'\s]+$/; $status .= "\nERR: Malformed email address for You : $from_email
" unless $from_email =~ /^[\w\-\.]+?\@[\w\-\.]+?\.\w+$/; if ($status eq '') { # no errors, try and send email my $img_lnk = qq(@{[$cgi->url]}?opt=img&gal=$gal_id&id=$img_name); $mail_body =~ s/<:\s*sender_name\s*:>/$from_name/g; $mail_body =~ s/<:\s*image_link\s*:>/$img_lnk/g; $mail_body =~ s/<:\s*image_name\s*:>/$img_name.jpg/g; my $mailmsg = < To: $to_name <$to_email> Subject: Image link MIME-Version: 1.0 Content-Type: TEXT/HTML; charset=US-ASCII $mail_body EOD $ENV{PATH} = ''; if (open(MAIL, "| $sendmail -oi -t")) { print MAIL $mailmsg; if (close(MAIL)) { # all's well $status = qq( The link was mailed successfully.
You can [ return to gallery ] or send the link to someone else:
); $to_email = ''; $to_name = ''; } else { # close failed $status = qq(\n ERR: There was a problem processing the message. Your link was not sent.
); log_err("ERR: Mail-a-link failure during mail process/send : $!"); } } else { # can't connect to server, log and err out $status .= qq(\n ERR: There was a problem connecting to the mail server. Your link was not sent.); log_err("ERR: Could not connect to sendmail : $!"); log_err(" Set the config var \$mail_a_link to 'FALSE' if this error persists"); } } } &PrintHead(); print qq(\n
 
); print qq(
$status
Sending an email link to a friend. (All fields are required)

Recipient's Name: (up to 30 characters long)

Recipient's Email address: (up to 80 characters long)


Your Name: (up to 30 characters long)

Your Email Address: (up to 80 characters long)


Sending a link to this image:
); &PrintTail(); }