Customizing internal email

# Customising Internal Email

There are several internally generated emails:

Delivery failure | Sent when a message cannot be delivered.
Delivery warning | Sent when there is a temporary delivery error.
Quota limit | Sent when a user reaches their quota.
Signup email | Sent to the user during the new user signup process.
Manager signup email | Sent to the manager during the new use signup process.
Account status | Sent to the user periodically.
Friends confirmation* | Sent to an unknown incoming email address for friends verification. (if in friends confirmation mode)
Kids-safe message | Sent to an unknown incoming email address. (if in friends kids-safe mode)
Centipaid message* | Sent when payment is required on an incoming message.
Email Notification* | Sent to a user supplied address to notify of incoming email on the account.

*These messages can be customised by the user as well, user customisations are stored in the users path and used in preference to defaults.

To customise a message you simply create a specific file in the SurgeMail installation path and into that file put the contents of the email. Some messages allow email headers to be included in the file, they are indicated below in the examples.

Type | File | Example | From header | MAIL FROM
--- | --- | --- | --- | ---
Delivery failure | failed.eml | example | g_from_header | <>
Delivery warning | warning.eml | example | g_from_header | <>
Quota limit | quota.eml | example | g_from_header | <>
Signup email | signup_user.eml or .msg | example | g_from_header | <>
Manager signup email | signup_manager.eml or .msg | example | g_from_header | <>
Account status | status.eml or .msg | example | g_from_header | <>
Friends confirmation | confirm.eml* or .msg | example | "email (g_friends_name system)" <email> | email
Kids-safe message | kid-safe.eml* or .msg | example | "email (g_friends_name system)" <email> | <>
Centipaid message | centipaid.eml or .msg | example | g_from_header | <>
Email Notification | enotify.eml or .msg | example | enotify_from, g_enotify_from, or account email | <same as from>

*In addition to this file the text:

    	For more information see http://netwinsite.com/surgemail/friends.htm

or another file friend_footer.eml (or .msg) is appended to these messages. (was friend.eml in versions prior to 1.6h)

As there are several things that change for each instance of these emails there are several special text replacement macros you can use, these macros operate in the same fashion as the ones on the SurgeMail admininstrative and user web pages. In fact a lot of the macros will function i.e. ||localtime|| and ||ifdef|| etc...

In addition each message has it's own set of macros which are available, they are...

failed.eml

Macro | Content
--- | ---
||domain|| | The domain name

Example

    When trying to deliver your message, the mail server at ||domain|| encountered
    problems with the following addresses.

    For a more detailed explanation see http://netwinsite.com/surgemail/deliver_failed.htm

warning.eml

Macro | Content
--- | ---
||domain|| | The domain name

Example

    When trying to deliver your message, the mail server at ||domain|| encountered
    problems with the following addresses. Still trying, no action required!

    For a more detailed explanation see http://netwinsite.com/surgemail/deliver_warning.htm

quota.eml

May contain email headers at the start of the file, hard-coded headers include To, From, X-AutoResponder, and Subject (if there are no headers in the file).

Macro | Content
--- | ---
||domain|| | The domain name.
||reason|| | The reason for this message.
||subject|| | Same as ||reason||.
||size|| | Size of the message that exceeded the quota (in bytes)
||sizek|| | Size of the message that exceeded the quota (in kbytes)
||max|| | Total size of quota (in bytes)
||maxk|| | Total size of quota (in kbytes)
||used|| | Amount of quota used (in bytes)
||usedk|| | Amount of quota used (in kbytes)
||usedandsize|| | Amount of quota used plus the size of the message (in bytes)
||usedandsizek|| | Amount of quota used plus the size of the message (in kbytes)
||user|| | The account username
||sender|| | The sender of the message that triggered this warning

Example

    Subject: Your quota has been exceeded used=||used|| msgsize=||size|| max=||max||

    reason: ||reason||

    Details: max=||max|| used=||used|| size=||size||

    This message is an automatic warning that you need to reduce disk usage
    you should read and delete messages from your inbox or other folders.

    If your mail client is set to ignore messages over a certain size, or leave
    messages on the server then changing that setting might be in order.

    For a more detailed explanation see http://netwinsite.com/surgemail/quota_warning.htm

signup_user.eml

May contain email headers at the start of the file, hard-coded headers include To, From, and Subject (if there are no headers in the file).

Macro | Content
--- | ---
||to|| | To address
||from|| | From address
||account|| | Account that has been requested
||url_add|| | URL to accept/complete the account signup
||url_decline|| | URL to decline/cancel the account signup

Example

    We received a request for an email account '||account||'.
    To create the account now please click the link below.
      ||url_add||
    If you did not request that account or have changed your mind please click on the link below
      ||url_decline||

signup_manager.eml

May contain email headers at the start of the file hard-coded headers include To, From and Subject (if there are no headers in the file).

Macro | Content
--- | ---
||to|| | To address.
||from|| | From address.
||account|| | Account that has been requested.
||ip|| | Ip signup came from.
||url_add|| | URLl to allow the account signup.
||url_decline|| | URL to decline the account signup.
||url_block|| | URL to block future signups from the same IP.
||begin_list_details|| ||end_list_details|| | This function loops X times where X is the number of fields the user filled in upon signup each time it loops it outputs ||field|| and ||value|| the field name and value the user supplied.

Example

    The account '||account||' has been requested from ip '||ip||'
    Details given:
    ||begin_list_details||
      ||field||: ||value||
    ||end_list_details||

    To ALLOW the account click the link below:
      ||url_add||

    To DISALLOW the account click the link below:
      ||url_decline||
    To BLOCK this signup and future signups from this ip click the link below:
      ||url_block||

status.eml

May contain email headers at the start of the file hard-coded headers include To, From, X-Friend and Subject (if there are no headers in the file).

Macro | Content
--- | ---
||to|| | To address.
||from|| | From address.
||url|| | URL to user self administration web interface.
||start|| | Time in secconds of last status message.
||end|| | Time in secconds now.
||friends|| | The g_friends_name setting.
||begin_list_pending|| ||end_list_pending|| | This function loops X times where X is the number of emails in the users pending folder. Each time it loops it outputs ||pending_idx||, ||pending_time||, ||pending_name||, ||pending_from||, ||pending_subject||, ||pending_score|| about the pending message.
||begin_list_spam_store|| ||end_list_spam_store|| | This function loops X times where X is the number of emails in the users spam store folder. Each time it loops it outputs ||store_idx||, ||store_time||, ||store_name||, ||store_from||, ||store_subject||, ||store_score|| about the stored message.
||account_log|| | This function outputs the contents of the users account log
||proto|| | Either "http" or "https" depending on server settings.
||host|| | The host and port of the surgemail web interface.

Example

    This message is an automatic status message sent to you because you are using ||friends||, Spam filtering,
    Account exceptions, or CentiPaid on this email account.

    To disable this login to the link below and go to the \"Log\" page.
      ||url||

    Report for the period
      ||localtime||start||
    till
      ||localtime||end||

    ||begin_list_pending||
    ||ifequal||pending_idx||0||
    ||friends|| messages waiting to be confirmed:
    ||endif||
    ||pending_from|||||pending_subject||
    ||end_list_pending||

    ||begin_list_spam_store||
    ||ifequal||store_idx||0||
    Held messages:
    ||endif||
    ||store_from|||||store_subject||
    ||end_list_spam_store||

    Record of messages processed:
    ||account_log||

confirm.eml

May contain email headers at the start of the file hard coded headers include To, From, Subject and X-Confirm. The file friend_footer.eml (was friend.eml in versions prior to 1.6h) is appended to this message. See also g_friends_confirm_subject.

Macro | Content
--- | ---
||confirm|| | Unique message identifier (required in reply to this message to confirm original message release).
||friends|| | The g_friends_name setting.
||email|| | Person who is requesting confirmation (From address of this confirmation).
||sender|| | Person who sent message that caused this confirmation (To address of this confirmation).
||subject|| | Subject header from the message that caused this confirmation.
||orig_email|| | To header from the message that caused this confirmation.
||orig_sender|| | From header from the message that caused this confirmation.

Example

    Your email to "||orig_email||" <||email||> with the subject "||subject||" has been blocked
    by the ||friends|| system.  ||email|| only accepts email from people on their list of friends,
    you are not currently on their list of friends.  If you would like to be added to the list
    simply reply to this message without changing the subject line.

kids-safe.eml

May contain email headers at the start of the file, hard coded headers include To, From, and Subject (if there are no headers in the file). The file friend_footer.eml (was friend.eml in versions prior to 1.6h) is appended to this message.

Macro | Content
--- | ---
||friends|| | The g_friends_name setting.
||email|| | Person who is denying message (From address of this confirmation).
||sender|| | Person who sent message that caused this denial (To address of this confirmation).
||subject|| | Subject header from the message that was denied.

Example

    Your message with subject "||subject||" was rejected as "||email||" has not listed your email address
    "||sender||" as a known address.  They are running in 'kids safe' mode so you must contact them via
    some other means to enable access.

centipaid.eml

May contain email headers at the start of the file hard coded headers include To, From, X-Autoresponder and Subject (if there are no headers in the file).

Macro | Content
--- | ---
||amount|| | The amount being charged.
||email|| | The person who received the message that caused this payment request.
||link|| | Link to pay and release held message.

Example

    Your email to ||email|| has been held-up due to its lack of postage.  This email account requries
    that you pay a postage of ||amount|| to allow the email to be delivered.
    To make this payment, please click the link below:
      ||link||
    When you complete the payment your original message will be delivered to ||email||.

enotify.eml

May contain email headers at the start of the file hard coded headers include Subject, To, and From (if there are no headers in the file).

Macro | Content
--- | ---
||from|| | The address the original message was from.
||to|| | The address the original message was to.
||body|| | The first 1024 characters of the original message body (can be trimmed/shortened, see example below)

In addition any/all headers are available using ||, eg ||subject||

Example

    Incoming message...
    Subject: ||subject||
    Date: ||date||

    Message Reads...
    ||trim...(body,50)||