The [Email options] section of the settings file is concerned with the email sent to the site owner after the form is successfully submitted.
The format of each setting in this section is
keyword = value
The following keywords are recognised:
Keyword | Purpose |
---|---|
ToAddress | the email address where notification will be sent when the visitor submits the form (your email address) |
BccAddress | email notification will be Bcc'd to this address if present |
FromAddress | email will appear to come from this address (unless visitor supplies an address in the fEmail standard field) |
FromName | email will use this as the visitor's name (unless the visitor supplies a name in the fFirstName and fLastName , or the fName standard field) |
Subject | text for the email subject. It may include one or more placeholders: %fSubject%, %fName%, %fFirstName%, %fLastName% - see standard fields |
EmailFormat | Specifies the format of the email sent to you - html or plain (default is html) |
EmailStart* | Introduction text to appear at the start of the email sent to you. |
EmailField* | Template for one field in the email. It must contain the placeholders %FieldName% and %FieldValue%.
The default template is <b>%FieldName%</b>: %FieldValue%<br /> which is suitable for HTML EmailFormat.
If you want the fields to be presented in an HTML table, this template can be a single table row, and you should place the opening
table tag in the EmailStart setting and its closing tag in the EmailExtra setting. |
EmailExtra* | text to be appended to the email body. Example: "Go to http://mysite.com.com/admin to view submissions" |
EmailStyle* | CSS to be used for HTML email |
DateFormat | format to use for any date fields. The default is %a %e %B %Y (for valid format characters, please refer to http://php.net/manual/en/function.strftime.php) |
SendToN | alternative email addresses (more information below) |
* The value for these keywords may be in the form file:pathname, in which case the contents of the specified file will be used as the value.
[Email Options] ToAddress = owner@yourdomain.com FromAddress = visitor@yourdomain.com FromName = Web visitor Subject = Message from your web site EmailStyle = body { font-family:Arial,Helvetica,sans-serif; font-size:small; color:#333366; } a { color:#aa5555; }
NOTE: You can bypass or replace the default email sent by twzContact by using a custom processing function.
Normally, the ToAddress
setting is where the email is sent. However, it is possible to send it to one of several alternative addresses instead, using the fSendTo standard field. The destination address will depend on the value of the fSendTo field selected by the visitor.
For example, your contact form might have a field called "Subject" which is a drop-down list. Depending on which subject the visitor selects, the email will be sent to one of several people. To demonstrate, refer to this extract of a settings file:
[Email options] ToAddress = owner@example.com.au SendTo1 = person_A@example.com.au SendTo2 = person_B@example.com.au SendTo3 = person_C@example.com.au [Fields] subject = select [Field Options] subject = 1=Web site,2=Advertising,3=Other stuff [Standard fields] fSendTo = subject
In the example above,
[Email options]
section has three alternative email addresses: SendTo1, SendTo2 and SendTo3 (we'll come to this later)[Fields]
section includes Subject, which has a field type select (drop-down list)[Field options]
shows that the value of Subject will be 1, 2 or 3 (depending on what the visitor selects)[Standard fields]
section says that Subject is a special fSendTo fieldI can understand this perfectly - can you?!!? ;-)