Postcard Direct Documentation

Contents


How does it work?

Postcard Direct works by MIME encoding any images, midi, flash etc. This means everything that is needed to display the postcard is contained in the mail body.

PD also works with two other modes:

  1. Web mail - Most web mail sites can't/won't handle embedded images in the email, so this mode references the images from the website the postcard was sent. Note that Yahoo Mail and Hotmail, in particular, change their interfaces reasonably regularly, so if the direct method works one day, it may not the next.
  2. Traditional mode - Works like all other postcard programs, ie: stores the card on your webserver and mails out a ticket to the recipient.


Operational Requirements

Before installing you must make sure that you have:

Note: You do not need to install any additional modules to run PD. All required modules are included.


Quick Install Guide

For experienced or impatient people only.

If you used the Auto-installer, you should have an operational postcard system ready to go.

If you have done a manual install, make sure the permissions are set correctly.

Once you have verfied that you have a working system by sending a test card from the PD example page, ie: http://www.yoursite.com/pd/postcards.html, you would then do:


Definitions

The following definitions are a used to clarify terms used in the documentation.

Full URL

The complete URL for your site, comprising the server name and the file path, eg: http://www.ginini.com.au/pd/images/bird.gif/

Short URL

A file path portion of the full URL. For example, for the full URL http://www.ginini.com.au/pd/images/bird.gif the short URL would be /pd/images/bird.gif

Full directory path

When you specify a URL of a file, the web server it is coming from will know the full directory path on the Operating System where to retrieve the file from. For example, if I have a short URL of /pd/midi the real location (full directory path) could be something like /home/ginini/htdocs/postcard-direct/midi
The actual path will vary from webserver to webserver.

The full directory path is displayed in the diagnostics section if an error occurs.


Installing

Auto Installer

You can try the auto-installer, if you don't want to manually install the files.

Extracting

The source is contained in a gzip tar file or ZIP file.

To unpack the gzip tar file, type:

gzip -dc postcard-direct.tar.gz | tar xvf -

To unzip the ZIP file, type:

unzip postcard-direct.zip

or use best to WinZip. Note that WinZip will handle both tar.gz and zip files.

This will create two top level directories:
pd - where the images, midi and html files exist.
cgi-bin/pd - where the scripts, admin, configuration and template files exist.

Copy the pd directory to the directory where your web documents exist.
Copy the pd directory from cgi-bin/pd to the directory where your CGI scripts exist. In most cases this will be your cgi-bin directory. Other locations maybe cgi-local or scripts.

IMPORTANT - When you FTP the files to your web server, make sure that only the graphics and midi files are transfered in binary mode, all other files should be transfered in ASCII mode. If you fail to do this, it will most likely cause the script to fail. Also note that the Auto setting on FTP clients such as WS-FTP is not always reliable.

Permissions

There are two sets of permissions that need to be set depending on how you are going to manage PD.

If you are going to administer PD via the pdadmin menu interface, you will need to set the following permissions:

/cgi-bin/pd (755)

/cgi-bin/pd/admin (777)
/cgi-bin/pd/admin/* (666)

/cgi-bin/pd/cache (777)
/cgi-bin/pd/cards (777)
/cgi-bin/pd/includes (755)
/cgi-bin/pd/includes/* (644)
/cgi-bin/pd/logs (777)

/cgi-bin/pd/configs (777)
/cgi-bin/pd/configs/* (666)

/cgi-bin/pd/modules (755)
/cgi-bin/pd/modules/* (644)

/cgi-bin/pd/stylesheets (777)
/cgi-bin/pd/stylesheets/* (666)

/cgi-bin/pd/designs (777)
/cgi-bin/pd/designs/* (777)
/cgi-bin/pd/designs/*/* (666)

/cgi-bin/pd/lists (777)
/cgi-bin/pd/lists/* (777)
/cgi-bin/pd/lists/*/* (666)

/cgi-bin/pd/templates (777)
/cgi-bin/pd/templates/* (777)
/cgi-bin/pd/templates/*/* (666)

/cgi-bin/pd/pdadmin.cgi (755)
/cgi-bin/pd/pd.cgi (755)
/cgi-bin/pd/pdedit.cgi (755)
/cgi-bin/pd/pdview.cgi (755)

/pd (755)
/pd/help (755)
/pd/midi (755)
/pd/midi/* (644)
/pd/images (755)
/pd/images/* (644)
/pd/uploads (777)

If you are going to administer PD by FTPing the files to and from your PC, then you can use the following (more restrictive) permissions:

/cgi-bin/pd (755)

/cgi-bin/pd/admin (755)
/cgi-bin/pd/admin/* (644)

/cgi-bin/pd/cache (777)
/cgi-bin/pd/cards (777)
/cgi-bin/pd/includes (755)
/cgi-bin/pd/includes/* (644)
/cgi-bin/pd/logs (777)

/cgi-bin/pd/configs (755)
/cgi-bin/pd/configs/* (644)

/cgi-bin/pd/modules (755)
/cgi-bin/pd/modules/* (644)

/cgi-bin/pd/stylesheets (755)
/cgi-bin/pd/stylesheets/* (644)

/cgi-bin/pd/designs (755)
/cgi-bin/pd/designs/* (755)
/cgi-bin/pd/designs/*/* (644)

/cgi-bin/pd/lists (755)
/cgi-bin/pd/lists/* (755)
/cgi-bin/pd/lists/*/* (644)

/cgi-bin/pd/templates (755)
/cgi-bin/pd/templates/* (755)
/cgi-bin/pd/templates/*/* (644)

/cgi-bin/pd/pdadmin.cgi (755)
/cgi-bin/pd/pd.cgi (755)
/cgi-bin/pd/pdedit.cgi (755)
/cgi-bin/pd/pdview.cgi (755)

/pd (755)
/pd/help (755)
/pd/midi (755)
/pd/midi/* (644)
/pd/images (755)
/pd/images/* (644)
/pd/uploads (777)

If you are not familar with what the numbers mean, the following table will help:

ModePermissionDescription
777rwxrwxrwxRead/Write/Execute for owner, group and other.
755rwxr-xr-xRead/Write/Execute for owner. Read/Execute for group and other.
666rw-rw-rw-Read/Write for owner, group and other.
644rw-r--r--Read/Write for owner. Read for group and other.

Where a * is specified, it means all files in that directory.

For Windows servers, 777 or 666 is roughly equivalent to read/write access for everyone, 755 is not applicable and 644 is roughly equivalent to write permission for the owner and read for everyone. Usually, only your ISP can change Windows permissions for you unless you have some type of Windows/Webserver admin interface.

Perl Locations

If your location of perl is not /usr/bin/perl then edit /cgi-bin/pd/pd.cgi, /cgi-bin/pd/pdadmin.cgi, /cgi-bin/pd/pdedit.cgi and /cgi-bin/pd/pdview.cgi to make sure the first line is the correct path for your perl location.

If you are installing on a Win/NT system, it depends which web server you are running as to whether the perl path is recognised. If you are running an Apache server, the path would be set to something like C:\perl\bin\perl.exe

On Microsoft IIS servers, CGI scripts are usually recognised by their extension. Generally this is set to be .cgi or .pl. If it is not set to .cgi you will need to rename the scripts to have the approprate extension.

Directory Structure

Under /cgi-bin/pd the following directories exist:

adminContains admin type files, eg: message database, admin password file etc.
cacheContains a cache of any remote images/objects.
cardsContains any cards that are due to be picked up and any cards stored to be sent at a later date.
configsContains the PD configuration file/s.
designsContains the design templates.
includesContains any include files for the postcard message.
listsContains list files, eg: badword list, midi list etc.
logsContains log file/s of postcards sent.
modulesContains Perl modules
stylesheetsContains CSS files
templatesContains the various form and other templates.

Under /pd the following directories exist:

helpContains the help files.
imagesContains sample images and icons.
midiContains midi files.
uploadsContains any uploaded images/objects.


Configuration

Configuration File

In most cases, PD should work without any configuration changes. If you need to correct any paths or change any options, you can either edit the configuration via the admin interface, eg: http://www.yoursite.com/cgi-bin/pd/pdadmin.cgi or transfer the pdconfig.txt file to your PC, make the changes, and then transfer back to the webserver.

The Postcard Direct configuration is split into main and optional configuration sections. The main section contains the most common settings you would need to change.

Main Configuration Section
$site_urlSet this to the full URL for your site. Don't add any filenames to the path. You only need to set this if PD can't automatically determine your website name.
$document_rootIf your web document root is not automatically determined, uncomment and set this the full directory path to the top level of your web documents. This directory path is where your home page would exist.
$url_alias You only need to add this setting if your URL contains a ~, eg: http://www.yoursite.com/~peter
$pdurl This is the short URL to where the PD images, help and midi files exist. Unless you are using non standard or an unusual location, this will always be /pd
$pdroot This is the full path to $pdurl. There should be no need to change this setting.
$expire By default, the admin login cookie will last for your browser session. If you want to put a time limit on it, uncomment this setting. +1h means expire after 1 hour.
$disable_uploads If you want to allow image uploads, then you will have to set the value to 0 and increase the upload limit in $maxpost to the desired size.

Mail Options
$SubjectSet to a default subject line if none is specified/required.
$sendmailUncomment this line if you want the mail to be sent by sendmail. The path for sendmail is automatically determined by the pd.cgi script, or overridden if you set $sendmail_path
$sendmail_queueYou can speed up the operation of the script by using the sendmail mail queue. This is also a more reliable way to send mail as the mail will stay in a queue if there are any transient delivery problems or sendmail isn't running. The only tradeoff is that the mail will take longer to be delivered as it will sit in the queue until sendmail processes it at whatever interval is defined, usually 15 mins.
$sendmail_pathIf your webserver has sendmail in an unusual location or if it uses a sendmail alternative like qmail, uncomment and set this path. This will override the automatic check for the sendmail path.
$smtp_serverIf you don't have sendmail on your server, set this to the Hostname of your SMTP mailserver. Leave set to localhost if the server you run the script on handles mail, otherwise set to the full hostname of the server that handles your mail (generally your ISP mail server). If your webserver is running on a Windows server, this is you will need to use this setting.

Admin Interface Section
$admin_referersSet this to a comma separated list of all the domain names that can call the pdadmin.cgi script. You should also include the IP address/es if you find the domain names are recognised. This means you will need to create a page on your website with a link to pdadmin.cgi in order to have the correct referer set. In most instances you probably don't want to do this.
$expireUncomment this setting if you want to have an expiry time on the admin login/session. If it is commented the admin session last until the browser is exited.

Anti-Leech Section
$AntiLeechSet to 1 to turn anti-leech functions on, 0 to turn off.
$referersSet this to a comma separated list of all the domain names that can call the pd.cgi script. You should also include the IP address/es if you find the domain names are recognised.

Mail Sender Section
$sender_emailSet to the email address that the postcard will come from.
$sender_nameSet to the sender name of the postcard.
$reply_toSet to an address if you want all replies to go to a single address.
$max_recipientsSet to the maximum number of recipients.

Requires Section
$require_sender_nameRequire the sender of the postcard to fill out their name.
$require_receiver_nameRequire the name of the recipient to be filled out.
$require_messageRequire the postcard message to be filled out.
$strict_email_checkIf this option is turned on additional checks are performed on the validity of the email address. If it is turned off, then the email address just has to be in a valid format.
$check_domainThis checks that the email address has a valid top level domain, eg: .com, .org, .au, .nz etc.
$allow_htmlIf this option is turned on, HTML will be allowed to be used in the postcard messages. By default HTML tags are stripped from the message.
$check_bad_usersIf this option is turned on, the email addresses of the sender and/or recipient are looked up in the badusers.txt file to see if they should be banned. This option is useful if you have a user is complaining of unwanted postcards.
$check_bad_wordsIf this option is turned on, the postcard message is checked against the list of banned words in the badwords.txt file.
$diagIf this option is turned on, diagnostic messages will be displayed on the error page.
$add_message_idYour mail server will generate a Message ID, but in some circumstances, it may not generate one that complies to the suggested Internet standard. Setting the following option will make PD generate its own Message ID.

Language Options
$langDefault language to use.
$titleThis is the default page title that is used if none is specified.

Message Options
$max_messageSet to the maximum allowable size of the message. This is to prevent people abusing the script by trying to send out huge postcards.
$message_dbLocation of the message database. This would not normally be changed.

Logging Options
$log_fileSet to a location where the log file will be written to.
$enable_loggingSet to 1 to enable logging or 0 to disable logging.

Remote Images Section
$remote_sitesSet this to the file that contains a list of all sites that you can specify a remote postcard image from.
$cache_expirySet this to the number of days that an image can exist in the cache before a new version is retrieved from the remote site.
$cache_ageSet this to the number of days that a cached image is stored before it is deleted. Set this value to be greater than $cache_expiry.

Image Upload Section
$disable_uploadsSet to 0 to enable and 1 to disable.
$maxpostIf you enable image uploads, you will need to increase this value from the default of 8KB.
$upload_dirThis is the directory to store uploaded images. Note that this directory needs to be writable by the webserver owner.
$upload_ageAge in days, that old uploaded images get deleted.
$upload_typesList of allowable upload types. Note that they are case insensitive.

Mode Options
$modeThis can be set to direct or traditional. If set to traditional, PD will operate like standard postcard systems, ie: send a ticket for the recipient to pick up their card. The following options are only used in traditional mode.
$postcard_dirLocation of where the postcards will be stored. By default, this is in the postcards directory where the PD HTML files exist.
$postcard_ageThis is the maximum age in days to store a postcard on the server before it is deleted.
$future_card_ageThis is the maximum age in days in the future that a card can be sent.
$receipt_subjectThe subject line for read receipts. Only applicable for receipts sent in the 'traditional' mode.

Templates Section
$formTemplate for the default input form.
$upload_formTemplate for the image upload form.
$sentTemplate for the confirmation page when the postcard is being sent.
$errorTemplate for any general error messages like missing cnofiguration files.
$input_errorTemplate for any invalid data entered in the postcard form.
$read_receiptTemplate for read receipts for cards sent in 'traditional' mode.
$card-expiredTemplate for expired cards.
$stylesheetDefault Stylesheet (CSS) to use for postcards.


Templates

There are templates to control the entire output of Postcard Direct. This means that no perl code needs to be changed in order to customise the web pages.

The templates consist of HTML code with special tags embedded in them. The special tags have a <pd_ prefix. You can also use special variables that a surrounded by percent signs %, for example:

%TITLE%

or

<pd_title>

These variables/tags are expanded to their appropriate value when the pd.cgi reads the template.

The reason that two methods are given is:

  1. Personal preference. You may decide that using special tags is easier to type and read, or visa-versa.
  2. Some HTML editors don't like %VARIABLES% or will change the formatting of them, in which case, using the special tags may help.

NOTE - You can mix both types of variables/tags if you desire.

Forms

There are a number of form templates which control the look of the postcard form where the user enters their message and who they are sending the postcard to. The following form templates are pre-defined:

Form name Description
form-default.txt This is the default form template and has the image above the input fields.
form-all.txt This template has most of the available features specified.
form-basic.txt This template is the same as the default template, but has the postcard design and music options removed.
form-side.txt This template places the image to the side of the form. It is best suited to images that aren't too large.
form-bcc.txt Same as the default template, but has a Bcc option for multiple recipients.
form-date.txt Same as the default template, but has a date option to allow the user to send the postcard at a later date.
form-fields.txt This template shows an example of using additional form fields.
form-colours.txt This template shows an example of using additional form fields to allow colour selections.
form-java.txt This template shows how to integrate a java applet.
form-traditional.txt This template is the same as the default template, but it uses the "traditional" method of sending the postcard.

The following special tags/variables can be used:

Variable Special Tag Description
%CGI% <pd_cgi> URL of the postcard CGI. Do not change this.
%IMAGE% <pd_image> URL of the postcard image
%OBJECT% <pd_object> URL of the postcard object
%WIDTH% <pd_width> Width of the postcard image
%HEIGHT% <pd_height> Height of the postcard image
%TITLE% <pd_title> Title of the image
%DESIGNS% <pd_designs> Select list of postcard designs.
Uses the default design if not specified.
%MIDI% <pd_midi> Select list of midi files.
%OBJECTS% <pd_objects> Select list of the object files.
%DATE% <pd_date> Date selection fields
%HELP% <pd_help> URL for the Postcard Direct Help file
%PDICON% <pd_icon> URL for the Postcard Direct Icon.
%STYLESHEET% <pd_stylesheet> Inserts a stylesheet. Uses pd.css by default.
%FIELD1% <pd_field1> Free form field that can be used for any purpose
%FIELD2% <pd_field2> Free form field that can be used for any purpose
%FIELD3% <pd_field3> Free form field that can be used for any purpose
%FIELD4% <pd_field4> Free form field that can be used for any purpose
%FIELD5% <pd_field5> Free form field that can be used for any purpose
%FIELD6% <pd_field6> Free form field that can be used for any purpose
%INCLUDE% <pd_include> Text from the specified include file

You can change or remove input fields by using HIDDEN fields. For example, if you want every postcard to have a midi file with it, edit the form template and:

Remove lines:

<tr>
<td><b>Music:<b>lt;td>
<td>
 <select name="midi">
  <pd_midi>
 <select>
<td>
<tr>
and add the following line in the section where all the other hidden fields are:

<input type="hidden" name="midi" value="favourite_song.mid">

If you want to change which postcard design the form template uses, change the line:

<input type="hidden" name="design" value=default.txt">

to be which ever postcard design you want it to use.

If you only have a single postcard design per form, then you can remove the design select list, by removing the lines:

<tr>
<td><b>Postcard Design:<b>lt;td>
<td>
 <select name="design">
  <pd_designs>
 <select>
<td>
<tr>

error.txt

This template is for any general Postcard Direct error messages like configuration problems.

The following variables/tags are available:

Variable Special Tag Description
%ERROR% <pd_error> Error message.
%SUGGESTION% <pd_suggestion> Suggestion message.
%DIAGNOSTIC% <pd_diagnostic> Additional diagnostic error messages.
%PERLVER% <pd_perlver> Perl version.
%SERVER% <pd_server> Web Server details.

input-error.txt

This template is for displaying any input errors such as invalid email addresses, fields not filled out, etc.

You can use the following variables (variables in bold are compulsary):

Variable Special Tag Description
%MESSAGE% <pd_error> Error message.
%BACK% <pd_back> Displays a "Back to Form" button.
%STYLESHEET% <pd_stylesheet> Inserts a stylesheet. Uses pd.css by default.

sent.txt

This template is used for displaying the confirmation screen when the postcard is being sent.

You can use the following variables/tags:

Variable Special Tag Description
%IMAGE% <pd_image> URL of the postcard image
%OBJECT% <pd_object> URL of the postcard object
%RECIPIENT% <pd_recipient> Name of the recipient
%RECIPIENT_EMAIL% <pd_recipient_email> Email address of the recipient
%SENDER% <pd_sender> Name of the sender
%SENDER_EMAIL% <pd_sender_email> Email address of the sender
%SUBJECT% <pd_subject> Subject of the postcard/email
%MESSAGE% <pd_message> Postcard message
%STYLESHEET% <pd_stylesheet> Inserts a stylesheet. Uses pd.css by default.
%SENT% <pd_sent> When the postcard will be sent.

read-receipt.txt

This template is used for sending a read receipt to the sender of the card. This is only applicable to cards sent in the 'traditional' mode.

Variable Special Tag Description
%RECIPIENT% <pd_recipient> is the name of the recipient.
%RECIPIENT_EMAIL% <pd_recipient_email> is the email address of the recipient.
%SENDER% <pd_sender> is the name of the sender.
%SENDER_EMAIL% <pd_sender_email> is the email address of the sender.
%SUBJECT% <pd_subject> is the subject of the postcard/email.
%STYLESHEET% <pd_stylesheet> Inserts a HTML stylesheet

expired-card.txt

This template is used for displaying the message when a users card has expired or they have specified an incorrect card id. This is only applicable to cards sent in 'traditional' mode.

Variable Special Tag Description
%RECIPIENT% <pd_recipient> is the name of the recipient. Inserts a HTML stylesheet
%SUBJECT% <pd_subject> is the subject of the postcard/email.
%STYLESHEET% <pd_stylesheet> Inserts a HTML stylesheet

upload.txt

This template is used for the image upload form.

Variable Special Tag Description
%PD_CGI% <pd_cgi> URL for pd.cgi. Do not delete.
%TITLE% <pd_title> Page title
%STYLESHEET% <pd_stylesheet> Inserts a HTML stylesheet


Design Files

Design files are just like the template files, but they are for the layout of your postcard. You can use any HTML code you like.

To add more postcard designs, create the new design template and add its name to the designlist.txt file.

You can use the following variables/tags. Note that you need to have either %IMAGE% or %OBJECT% defined:

Variable Special Tag Description
%TITLE% <pd_title> Title of the image
%IMAGE% <pd_image> URL of the postcard image
%WIDTH% <pd_width> Width of the postcard image
%HEIGHT% <pd_height> Height of the postcard image
%OBJECT% <pd_object> Embeds an object file in the postcard
%FIELD1% <pd_field1> Free form field that can be used for any purpose
%FIELD2% <pd_field2> Free form field that can be used for any purpose
%FIELD3% <pd_field3> Free form field that can be used for any purpose
%FIELD4% <pd_field4> Free form field that can be used for any purpose
%FIELD5% <pd_field5> Free form field that can be used for any purpose
%FIELD6% <pd_field6> Free form field that can be used for any purpose
%RECIPIENT% <pd_recipient> Name of the recipient
%RECIPIENT_EMAIL% <pd_recipient_email> Email address of the recipient
%SENDER% <pd_sender> Name of the sender
%SENDER_EMAIL% <pd_sender_email> Email address of the sender
%SUBJECT% <pd_subject> Subject of the postcard/email
%MESSAGE% <pd_message> Postcard message
%MIDI% <pd_midi> Embeds a midi file in the postcard
%STYLESHEET% <pd_stylesheet> Inserts a stylesheet. Uses pd.css by default.
%BACK% <pd_back> put a "Return to Form" button on the page when preview is selected
%SEND% <pd_send> put a "Send Postcard" button on the page when preview is selected


Multi-Lingual Support

PD is designed to easily support multiple languages. See list of currently supported languages.

English is the default language, although this can be changed in the configuration file.

You specify a non default language by using the lang parameter. For example:

pd.cgi?lang=br;image=/pd/images/photo.jpg

Each language is represented by its two letter ISO639 code. If no specific ISO639 code exists for a language, use the appropriate two letter country code.

To add support for a new language, you need to edit/create the following:

/cgi-bin/pd/admin/messages.txt This file contains a list of all the messages generated by the script. Add a translation for each message type.
/cgi-bin/pd/admin/languages.txt This file contains a list of all supported languages. Add the two letter language code and description to the file.
/cgi-bin/pd/modules/pddates.pm This file contains a list of the short month names. It is used in the form-dates.html template
/cgi-bin/pd/modules/charsets.pm This file contains any charsets required for a particular language. The default is ISO-8859-1.
/cgi-bin/pd/templates/language Create a new directory for the HTML templates and copy/translate existing templates.
/cgi-bin/pd/lists/language Create a new directory for the lists and copy/translate existing lists.
/cgi-bin/pd/designs/language Create a new directory for the postcard designs and either create new postcard designs or copy in existing designs.
/pd/help/language/help.html Create a new directory and translate an existing help file.


Log File

Postcard Direct writes an entry in a log file everytime a postcard is sent out (if logging is enabled). The Admin Menu has an option to view a summary of the log entries.

The format of the logfile is:

Field Description
Date Date in YYYY-MM-DD format. Y2K complient
Time Time the postcard was sent in HH:MM format
Method Sending method. Either html, web or plain
Design The postcard design that was used
Image URL Postcard image
MIDI Name of midi file
Object Name of the object file
Remote Host Hostname where the request came from
Subject Postcard subject
Sender email Email address of the sender
Sender name Name of the sender
Recipient email Email address of the recipient
Recipient name Name of the recipient
Send Date The date the card has/will be sent
BCC BCC option specified
Send Copy Copy was sent to the sender
Field 1 Free form field
Field 2 Free form field
Field 3 Free form field
Field 4 Free form field
Field 5 Free form field
Field 6 Free form field
Message Postcard message


Testing

If you have a command line access on your web server, you can check that the syntax of the scripts is correct by typing:

perl -c pd.cgi

If no errors are reported, try running the script using:

./pd.cgi

If everything is correct, it will spit out some HTML code saying it requires an image URL.

Once you reach this point, try invoking it from your web browser using the sample image, eg:

http://www.yoursite.com/cgi-bin/pd/pd.cgi?image=/pd/images/photo.jpg


Modes of Operation

General

You can use images that are stored anywhere on your webserver that is viewable. They do not need to be in any particular directory. The most common form of operation is to just specify the path to the image for the postcard. For example:
/cgi-bin/pd/pd.cgi?image=/pd/images/photo.jpg

If you are using an media type like, flash, quicktime etc, you should use the object parameter, for example:

/cgi-bin/pd/pd.cgi?object=/objects/movie.swf

You can specify a remote image (so long as your cache directory and remotesites.txt file are set correctly), for example:

/cgi-bin/pd/pd.cgi?image=http://www.somewhere.com/images/photo.jpg

You can specify the optional title parameter if you want to use titles for your postcards, for example:

/cgi-bin/pd/pd.cgi?image=/pd/images/photo.jpg;title=This+is+the+title+for+the+postcard

Note that spaces should be encoded with a +

You can specify which form to use (defaults to form-default.txt), with the form parameter, for example:

/cgi-bin/pd/pd.cgi?image=/pd/images/photo.jpg;form=myform.txt 

If you have multiple configuration files (defaults to pdconfig.txt), you can specify then with the config parameter, for example:

/cgi-bin/pd/pd.cgi?image=/images.photo.jpg;config=myconfig.txt

Or you can combine as many parameters as you like, for example:

/cgi-bin/pd/pd.cgi?image=/images.photo.jpg;config=myconfig.txt;title=My+Title;form=myform.txt

You can preload the form fields with particular values, for example:

/cgi-bin/pd/pd.cgi?image=/images/photo.jpg;subject=my+own+subject;sender=My+Name

Make sure that when you specify the URL for the postcard image you use the full document path from your web root ie: has a leading /. For example, use a path like /postcards/images/photo.jpg rather than ../images/photo.jpg

Parameters

The full list of parameters available are:

Parameter Description Example
image URL to a postcard image. image=/pd/images/photo.jpg
object URL to a postcard object. object=/objects/cartoon.swf
title Title of the postcard. Uses the default if none specified. title=Some+Postcard+Title
subject Subject of the postcard. Uses the default if specified in the configuration file. title=Some+Subject
include Includes the text from the specified include file. include=pd.txt
config Name of alternative configuration file. Uses the default if none specified. config=myconfig
form Name of postcard form to display. Uses the default if none specified. form=form-java.txt
stylename Name of stylesheet to use. Uses the default if none specified. stylename=newstyle.css
lang Language to use. Uses the default if none specified. lang=de
upload Invoke the image upload form. upload=yes

Thumbnails

The most common way of setting up a Postcard site is to have a page of thumbnail images, with the postcard using the full sized image. For example, assume the following directories:

/postcards/large (Directory for full sized images)
/postcards/th    (Directory for thumbnail images)
/postcards/index.html (Postcard index page)
then in you index.html page, you would use a link like:
<a href="/cgi-bin/pd/pd.cgi?image=/postcards/large/photo.jpg"><img src="/postcards/th/photo.jpg" border="0" alt="Click to send as a postcard"></a>

Flash Postcards

When specifying a flash object, use the object parameter, and specify the form template for flash postcards, for example:

/cgi-bin/pd/pd.cgi?object=/objects/movie.swf;form=form-flash.txt

By default, the form-flash.txt template will use the flash.txt design template. If you want to change this, edit the form template, and change the line:

<input type="hidden" name="design" value="flash.txt">

To point to the desired design template. Note that the sending method is set to traditional via a hidden field. Embedded flash objects in a email is unreliable as lot of mail clients don't support it, or their security restrictions prevent viewing it.

Java Postcards

To specify a java postcard, specify the java form template, for example:

/cgi-bin/pd/pd.cgi?image=/images/photo.jpg;form=form-java.txt

You will need to edit the form template and the java design template (defaults to java.txt) to insert whatever java applet you want to run.

Note that the Java form template has no sending options. It defaults to the web method. This is because you can't embed a java applet in an email message.

Multi-Lingual Postcards

If you want to set up postcards for different languages, use the lang parameter. For example:

/cgi-bin/pd/pd.cgi?image=/images/photo.jpg;lang=de

This example would use the German templates and German messages.

The default language is English, although this can be changed in the configuration file.

Also, see the example multi-lingual page to see how to use Javascript and a select list to choose the language.

Traditional Postcards

If you want to offer a Postcard service that operates like all other postcard sites (ie: mails a ticket to the recipient for them to pick up their postcard), use the traditional form template. For example:
/cgi-bin/pd/pd.cgi?image=/images/photo.jpg;form=form-traditional.txt

You can edit the traditional.txt design template to modify the message sent to the recipient. You can make the traditional mode the default method by setting $Mode='traditional' in the configuration file.


Image Uploads

If you want to allow users to upload their own images to use as postcards, you will need to change the following default settings:

In /cgi-bin/pd/configs/pdconfig.txt, set $disable_updates=0; and $maxsize to the largest size image you want to accept.

To invoke the upload form, use:

/cgi-bin/pd/pd.cgi?upload=yes

The image will be uploaded to whatever $UploadDir directory (default /pd/postcards) is set to, and will automatically be deleted after the number of days set in $UploadAge.


Scheduling Pending Cards via a cronjob

If you have pending cards to be sent at a later date, you can schedule a cronjob (probably to run daily) that will check and send any cards due to be sent. Note that the any pending cards are checked whenever a card is sent, so long as you have at least one card per day sent from your site, you won't have any pending cards sent on the wrong date.

The cronjob needs to call:

/full/path/to/cgi-bin/pd/pd.cgi sendcards=yes


Card Maintenance/Expiry

The following types of PD files are stored on the web server and expired/deleted at specified times:

TypeDirectoryDescriptionConfiguration Option/s
Uploaded Images /pd/uploads ($upload_dir) If image uploads are enabled, then users can upload their own images for the postcard. These images are stored in the directory specified by $upload_dir. $upload_age specifies the number of days an uploaded image is kept before it gets deleted.
Traditional Cards /cgi-bin/pd/cards ($postcard_dir) When a card is sent in "traditional" mode, a copy of the card is stored on the server for the recipient to "pick up". The card is stored in a file with a big long number with a .card extension, eg: 11691324960.629362261462123.card. Additionally, if a return receipt was requested, there will be a similarly named file with a .receipt extension. $postcard_age - Number of days the stored card will be kept on the server before it is deleted.
Future Cards /cgi-bin/pd/cards ($postcard_dir) Any cards to be sent a a future date are stored as a file with a big long number and the .mail extension. A database of the cards to be sent is kept in .storecards.db The future card files are only deleted when they are successfully sent.
Remote cached images/cgi-bin/pd/cache ($cache_dir) If remote images are allowed to be used for cards, they are downloaded and stored in a cache directory. $cache_age is the maximum age in days before the cached image is deleted.

Administration Interface

Most operations such as editing templates and configuration files can be done through the administration interface. The administration interface is accessed through pdadmin.cgi. For example:

http://www.yoursite.com/cgi-bin/pd/pdadmin.cgi

If you forget your password, you can reset it by editing the /cgi-bin/pd/admin/auth file and deleting the second field, eg:

pdadmin:

Upgrading from version 5.x.x

The easiest way to upgrade is to save your modified templates and configuration file and do a fresh install.

  1. Save a copy of your configuration file if you have made any changes to it (apart from setting the paths).
  2. Save all your modified form and design templates.
  3. Save any stored cards (if you operation PD in traditional mode). These will be stored in the /pd/postcards directory.
  4. Remove your existing PD installation.
  5. Install PD 6.
  6. Edit the configuration file (/cgi-bin/pd/pdconfig.txt) and set any of the changes from the old version. Note that all the variable names are now in lowercase for consistency and easier editing, so don't cut and paste entries from a PD5 configuration file.
  7. Put back any saved form/design templates. Remember that the form templates now have a .txt entension instead of .html (this is for consistancy reasons).
  8. Put back any stored cards into /cgi-bin/pd/cards. Also ensure the permissions are set to 777 on each of the files.

Note that as there are additional fields in the log file, you will not be able to use the Usage Report with the logs from PD version 5.x.x.


Win/NT Notes

If you are running Postcard Direct on Win/NT systems, please note the following:


Limitations

There are a some limitations using the Postcard Direct method of sending the postcard to the user via email as there is no set standard for handling HTML formatted mail. There shouldn't be a problem if the recipients mail client handles MIME correctly.

The following limitations are known about:


FAQ/Support

The FAQ is contained in this document.

Support issues can be found on the Support Forums.

If you are still running PD 5.x.x, you can read the relevant documentation for that version.


Return to main page