【发布时间】:2015-11-09 15:07:17
【问题描述】:
我正在使用来自 London Perl mongers 的 formmail Perl 脚本(Matt 的脚本存档)来处理我创建的几个 Web 表单。我在 cgi-bin 中有脚本,它似乎可以工作;但是,电子邮件输出只是一个没有格式的长列表。我正在使用记事本中的 Perl 脚本,并且在 Windows 计算机上。我只做了一些修改来为我的客户个性化脚本。我现在几乎没有关于 Perl 的任何事情。我以前用过这个脚本;但我不知道为什么输出是一个没有格式的长列表。我通过服务器的 cpanel 上传了脚本,因为我无法使用我当前的 ftp 程序将它传送到 ftp。他们使用的服务器很旧而且显然不安全。我不知道这是否有区别。如何使输出类似于普通电子邮件而不仅仅是列表。
电子邮件如下所示:
Below is the result of your feedback form. It was submitted by
hello () on Thursday, August 13, 2015 at 17:35:02
---------------------------------------------------------------------------
todayDate: 08/13/2015
ssn: 123456789
refer: self
birthdate: 08/02/2015
age: 32
gender1: Female
religion: yes
ethnicity: ethnic
address: 1234
city: big
state: CA
zip: 12345
homephone: 5105105100 32135684
workphone: 5105105100
cellphone: 5105105100
creditcard: na
nameOnCard: na
Occupation: work
employerName: hello there
employerAddress: 1234 street
employerCity: all city
employerState: CA
employerZip: 12345
education: BA Degree
inSchool2: No
marriedOrcommit: Yes
howLong: forever
namePartner: honey
occupationPartner: working hard
youPrev: none
我正在使用以下 Perl 脚本:
#!/usr/bin/perl -wT
#
# NMS FormMail Version 3.14c1
#
use strict;
use vars qw(
$DEBUGGING $emulate_matts_code $secure %more_config
$allow_empty_ref $max_recipients $mailprog @referers
@allow_mail_to @recipients %recipient_alias
@valid_ENV $date_fmt $style $send_confirmation_mail
$confirmation_text $locale $charset $no_content
$double_spacing $wrap_text $wrap_style $postmaster
$address_style
);
# PROGRAM INFORMATION
# -------------------
# FormMail.pl Version 3.14c1
#
# This program is licensed in the same way as Perl
# itself. You are free to choose between the GNU Public
# License <http://www.gnu.org/licenses/gpl.html> or
# the Artistic License
# <http://www.perl.com/pub/a/language/misc/Artistic.html>
#
# For help on configuration or installation see the
# README file or the POD documentation at the end of
# this file.
# USER CONFIGURATION SECTION
# --------------------------
# Modify these to your own settings. You might have to
# contact your system administrator if you do not run
# your own web server. If the purpose of these
# parameters seems unclear, please see the README file.
#
BEGIN
{
$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 2;
$mailprog = '/usr/lib/sendmail -oi -t';
$postmaster = 'sylviavanhorn@gmail.com';
@referers = qw(expressivehearts.com localhost);
@allow_mail_to = qw(sylviavanhorn@gmail.com localhost);
@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 = '/public/css/jane.css';
$no_content = 0;
$double_spacing = 0;
$wrap_text = 0;
$wrap_style = 1;
$address_style = 0;
$send_confirmation_mail = 0;
$confirmation_text = <<'END_OF_CONFIRMATION';
From: expressivehearts@gmail.com
Subject: New Client Forms Submission
Thank you for your submission.
END_OF_CONFIRMATION
# You may need to uncomment the line below and adjust the path.
# use lib './lib';
# USER CUSTOMISATION SECTION
# --------------------------
# Place any custom code here
# Email Header
print MAIL "To: $postmaster\n";
print MAIL "From: $realname\n";
print MAIL "Subject: $subject\n\n";
print MAIL "Content-type: text/html\n";
# USER CUSTOMISATION << END >>
# ----------------------------
# (no user serviceable parts beyond here)
}
#
# The code below consists of module source inlined into this
# script to make it a standalone CGI.
请注意:我只粘贴了 Perl 脚本的一部分,因为它很长;它应该是一个独立的脚本。
【问题讨论】:
-
这东西是史前的,只有真正与现代 Perl 有共同的名字。简而言之,不要再使用它了。今天有更好的事情。如果您只是想为您的客户收集表单数据并且您不了解编程,请考虑使用Google Forms。
-
我无法使用 Google 表单;它们不安全,也不符合 HIPAA。
-
“如何使输出类似于普通电子邮件而不仅仅是列表”是什么意思?