\GSPPanel\Emails
This class allows interaction with the email system
Methods
AddTemplate(array $params) : arrayAdds a template to the database
$params requires the following:
- subject: Subject of the email
- content: Content of the email
Returns one of the following in an array format:
- error
- -1 - Required field is left empty
- 0 - Added successfully
| Name | Type | Description |
|---|---|---|
| $params | array |
| Type | Description |
|---|---|
| array |
DeleteTemplate(array $params) : arrayDeletes a template from the database
$params requires the following:
- templateid: The template id to delete
Returns one of the following in an array format:
- error
- -1 - No template id provided
- -2 - Unable to find the template in the database
- 0 - Deleted successfully
| Name | Type | Description |
|---|---|---|
| $params | array |
| Type | Description |
|---|---|
| array |
EditTemplate(array $params) : arrayEdits a template in the database
$params requires the following:
- templateid: ID of the template to edit
- subject: Subject of the email
- content: Content of the email
Returns one of the following in an array format:
- error
- -1 - No template id provided
- -2 - Field left empty
- 0 - Saved successfully
| Name | Type | Description |
|---|---|---|
| $params | array |
| Type | Description |
|---|---|
| array |
GetTemplate(integer $templateid) : arrayReturns an array of template data
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $templateid | integer | The template id for the email |
| Type | Description |
|---|---|
| array |
ListTemplate() : arrayReturns an array of email templates
Returns
| Type | Description |
|---|---|
| array |
SendMail(array $params) : arraySend an email to a user, this function calls ReplaceVars and GameReplaceVars
$params requires the following:
- type: Template type(from Email settings)
- templateid: The ID of the email template(optional, needed if type not specified)
- subject: The subject of the email(optional, needed if type and templateid are not specified)
- content: The content of the email(optional, needed if type and templateid are not specified)
- uid: UserID to send email to
- email: Email address to send to(required if uid is not specified)
- ugid: User's gameserver id(optional)
- replace: Array of strings to replace($array['original_string'] => "newstring", optional)
Returns one of the following in an array format:
- error
- -1 - No template type, template id, subject or content provided
- -2 - No userid or email address provided
- -3 - No email template found matching specified criteria
- -4 - User not found or does not have an email address
- -5 - Unable to load phpmailer (REMOVED)
- -6 - No smtp server set
- -7 - Unable to send mail, check "message"
- -8 - No user server found
- -9 - Invalid email address
- 0 - Sent successfully
| Name | Type | Description |
|---|---|---|
| $params | array |
| Type | Description |
|---|---|
| array |