Archive

Posts Tagged ‘email’

Step-by-step installing

March 8th, 2009

This is a tutorial that shows how to install the Contact Form with Mail Attachments component.
Contact Form with Mail Attachments is a Flash, actionscript 3, mail contact form component that suppports multiple mail attachments. The server side script is in php.

Customize globals.php

 

Set here the server details that match your identity.

  • $TO : Set this to be the email address to which the message will be sent  (likely your email)
  • $SUBJECT : Set here the subject of the mail (sent to the $TO address);  <NAME> will be replaced by code with the name of the sender (filled in the ‘Your Name’ field of the form)
  • $CONFIRMATION_SUBJECT : The subject of the confirmation mail (the confirmation mail will be sent to the mail address of the sender: filled in the ‘Your Email’ field of the form)
  • $CONFIRMATION_MESSAGE : Set in this variable the body of the confirmation mail (the confirmation mail will be sent to the mail address of the sender: filled in the ‘Your Email’ field of the form, it confirms that his mail was successfully sent; it also contains a copy of his original message)
  • $CONFIRMATION_NAME : Set here your name; will appear in the header of the mail in front of $CONFIRMATION_MAIL (John Doe [mail@example.com])
  • $CONFIRMATION_MAIL : Set this to be your mail (will apprea near your name: John Doe [mail@example.com])

 

Install the scripts

 

  • Inside the directory where you want to install your app, create a subdirectory ’scripts’. Make the directory permissions 775: rwx-rwx-r-x (this is because flash player will directly access the scripts and php will need r-w permissions here: creates directories and stores uploaded files, then deletes them after the email is sent)
  • Copy all the php scripts inside this newly created directory. Make each file’s permissions 644: rw–r—r–

Install the flash files

 

  • Inside the directory where you want to install the contact form, outside the ’scripts’ directory (you don’t need to install where the scripts directory is, you can install anywhere as the paths to the scripts can be configured in contact.xml file): copy all the necessary files – contact.swf, AC_RunActiveContent.js, contact.html and data directory
  • Make sure that the files have 644 permissions, data directory should have 755, and contact.xml from inside data directory should also be 644

Customize data/contact.xml file

 

  • Open data/contact.xml file in a text editor (notepad will do great, don’t use a word processor like MS Word)
  • Inside this file, the <php> tag must be edited to reflect the real script paths: <mailscript> tag, set it’s path attribute to be the path to the ’sendmail.php’ script; <upload_script> tag, set it’s path attribute to be the path to the ‘upload_file.php’ script – these paths can be relative or absolute;

 For example:

<php>
<mailscript path="scripts/sendmail.php" />
<upload_script path="scripts/upload_file.php" />
</php>

This assumes that the ’scripts’ directory is in the same directory as ‘contact.swf’ file

  • Everything else in the xml file is optional, meaning it can be left as it is
  • <title> : The Title that appears at the top of the contact form
  • <yourname>, <yourmail>, <message> : <caption> – ‘optional’ attribute specifies whether the current field is optional or required when validating the form: valid values “true” – meaning optional, “false” – meaning required; The text inside the <caption> tag is  the text that will appear next to the corresponding text field;

<text> – ‘default’ attribute sets the default text that appears inside the corresponding input text field; when this textfield receives focus, this text will be cleared; ‘clearOnClose’ attribute specifies whether the text inputted will be cleared when the form is closed or not: valid values “true” – meaning the text will be cleared, “false” – the text will remain uncleared, so that when the form is reopened, the last text inputted in this filed it’s still there

  • <error>:  <messages> – sets the error messages when the form is not filled correctly
    • <yourname>, <yourmail> and <message>: ‘empty’ attribute – this error will be displayed when the input textfield is empty and the textfield has been declared as required (see previous point)
    • <yourmail>: ‘notValidated’ attribute – this error appears when the email entered in the <yourmail> tag is not a valid email address
  • <close>: if  ‘visible’ attribute on <button> tag is ‘true’, the close button is visible, if it’s ‘false’, it’s not visible
  • <submit>: <event> : ‘closeFormUponSubmit’ – valid values: ‘true’ – meaning the form will be closed if the form is successfully submitted, ‘false’ the form will not be closed
  • <files> : <upload_file> : ‘max_file_size’ set this the maximum allowed file size in KiloBytes; if the file is bigger than this value, the file will not be added to upload list
    • <file_filter>:  ‘type’ attribute – Set the type of files allowed by this filter; accepts wildcards (*): to allow mp3 files ‘*.mp3′; to allow more types by one filter: ‘*.mp3;*.wav’; ‘description’ attribute – Sets the description associated with this filter; These filters work based on file extensions!

 

 

To set file attributes in terminal:

chmod UGO file

Where UGO is the file perrmission: U – user permission (owner)

G – group permission

O – others permission (public)

1 – execute

2 – write

4 – read

Example: 644 – U=2+4=write+read

G=4=read

O=4=read

Components, Contact Form With Attachments v1.1 , , , , , , ,