Email Service

Email Service Management can be used by the app to configure host email account and send emails to one or multiple recipients. Developers can create and manage templates for sending mails as well. This module is also used in launching Email Campaigns through App42 Marketing Automation.

Import Statement
  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
Initialize

In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.

Required Parameters

apiKey - The Application key given when the application was created. secretKey - The secret key corresponding to the application key given when the application was created.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
Build Service

After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of EmailService, buildEmailService() method needs to be called.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
Create Email Configuration

Create Email Configuration using which in future the developer can send mails.

Required Parameters

emailHost - Email Host to be used for sending mails. emailPort - Email Port to be used for sending mails. emailId - Email ID to be used for sending mails. password - Email Password to be used for sending mails. isSSL - Should be sent using SSL or not.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
`
Get Email Configuration

Get all Email Configurations for the app.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
`
Send Email

Send the email to user to whom you want to send, email will be sent from configuration that you have created.

Required Parameters

senderEmailId - The Email ID using which the mail has to be sent. sendTo - The email IDs to which the email has to be sent. Email can be sent to multiple email IDs. Multiple email ids can be passed using comma as the separator. For example support@shephertz.com, info@shephertz.com. sendSubject - Subject of the Email which to be sent. sendMsg - Email body which has to be sent. emailMime - MIME Type to be used for sending mail. EmailMime available options are PLAIN_TEXT_MIME_TYPE or HTML_TEXT_MIME_TYPE.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
`
Remove Email Configuration

Removes the email configuration for the given email ID which you have configured
Note: In future the developer won’t be able to send mails through this ID.

Required Parameters
emailId - The email ID for which the configuration has to be removed.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
`
Send Email With Custom Email Template

Send the email to user to whom you want to send, email will be sent from configuration that you have created.

Required Parameters

senderEmailId - The Email ID using which the mail has to be sent. sendTo - The email IDs to which the email has to be sent. Email can be sent to multiple email IDs. Multiple email IDs can be passed using comma as the separator. For example support@shephertz.com, info@shephertz.com. sendSubject - Subject of the Email which to be sent. sendMsg - Email body which has to be sent. emailMime - MIME Type to be used for sending mail. EmailMime available options are PLAIN_TEXT_MIME_TYPE or HTML_TEXT_MIME_TYPE.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
`
Exception Handling

The functions available under Email API can throw some exceptions in abnormal conditions. For example if a developer is removing the email configuration that does not exist, the function will throw the App42Exception (as shown below) with the message as “Not Found” and the appErrorCode as “2303” and the details as “Email with the id ‘nick@gmail.com’ does not exist”.

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for Swift
  • create User Api for Java
  • create User Api for Unity
  • create User Api for JS
  • create User Api for Corona
  • create User Api for Cocos2DX
  • create User Api for .Net
  • create User Api for PHP
  • create User Api for Marmalade
  •  create User Api for Ruby
  •  create User Api for Flash
`
Error Codes

Functions in Email API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):

1400 - BAD REQUEST - The Request parameters are invalid. 1401 - UNAUTHORIZED - Client is not authorized. 1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again. 2300 - NOT FOUND - Email parameters not found. 2301 - BAD REQUEST - The request parameters are invalid. Email id '@emailId' already exists. 2302 - NOT FOUND - Email configurations do not exist. 2303 - NOT FOUND - Email with the id '@emailId' does not exist.