Email Service

This module acts as an Email Service Management that can be used by App to configure email ids and send mails to one or multiple recipients.

Import Statement

  • create User Api for Android
  • create User Api for Windows
  • create User Api for iOS
  • create User Api for J2ME
  • 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
import com.shephertz.app42.paas.sdk.android.App42API;
import com.shephertz.app42.paas.sdk.android.App42Response;
import com.shephertz.app42.paas.sdk.android.App42Exception;
import com.shephertz.app42.paas.sdk.android.App42BadParameterException;
import com.shephertz.app42.paas.sdk.android.App42NotFoundException;
import com.shephertz.app42.paas.sdk.android.email.Email;
import com.shephertz.app42.paas.sdk.android.email.EmailMIME;
import com.shephertz.app42.paas.sdk.android.email.EmailService;
using com.shephertz.app42.paas.sdk.windows;  
using com.shephertz.app42.paas.sdk.windows.email;   
#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"   
import com.shephertz.app42.paas.sdk.jme.App42API;
import com.shephertz.app42.paas.sdk.jme.App42Response;
import com.shephertz.app42.paas.sdk.jme.App42Exception;
import com.shephertz.app42.paas.sdk.jme.App42BadParameterException;
import com.shephertz.app42.paas.sdk.jme.App42NotFoundException;
import com.shephertz.app42.paas.sdk.jme.email.Email;
import com.shephertz.app42.paas.sdk.jme.email.EmailMIME;
import com.shephertz.app42.paas.sdk.jme.email.EmailService;
import com.shephertz.app42.paas.sdk.java.App42API;
import com.shephertz.app42.paas.sdk.java.App42Response;
import com.shephertz.app42.paas.sdk.java.App42Exception;
import com.shephertz.app42.paas.sdk.java.App42BadParameterException;
import com.shephertz.app42.paas.sdk.java.App42NotFoundException;
import com.shephertz.app42.paas.sdk.java.email.Email;
import com.shephertz.app42.paas.sdk.java.email.EmailMIME;
import com.shephertz.app42.paas.sdk.java.email.EmailService;
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.email;
<script type="text/javascript" src="App42-all-x.x.x.min.js">&lt;/script>
local App42API = require("App42-Lua-API.App42API")
#include "App42API.h"
using com.shephertz.app42.paas.sdk.csharp;  
using com.shephertz.app42.paas.sdk.csharp.email;  
include_once '../EmailService.php'; 
include_once '../App42Response.php';  
include_once '../App42Exception.php';   
include_once '../App42BadParameterException.php';  
include_once '../App42NotFoundException.php';  
#include "App42API.h"
require 'App42_Ruby_API'
import com.shephertz.app42.paas.sdk.as3.App42CallBack;
import com.shephertz.app42.paas.sdk.as3.App42API;
import com.shephertz.app42.paas.sdk.as3.App42Response;
import com.shephertz.app42.paas.sdk.as3.App42Exception;
import com.shephertz.app42.paas.sdk.as3.App42BadParameterException;
import com.shephertz.app42.paas.sdk.as3.App42NotFoundException;
import com.shephertz.app42.paas.sdk.as3.email.Configuration;
import com.shephertz.app42.paas.sdk.as3.email.Email;
import com.shephertz.app42.paas.sdk.as3.email.EmailService;
Coming Soon

Initialize

In order to use various functions available in a specific API, a developer has to initialize with App42API by passing the apiKey and secretKey which will be created 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 J2ME
  • 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
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; 
App42API.initialize("API_KEY","SECRET_KEY");
App42API.initialize("API_KEY","SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
App42.initialize("API_KEY","SECRET_KEY");
App42API:initialize("API_KEY","SECRET_KEY")
App42API::Initialize("APP_KEY", "SECRET_KEY");
App42API.Initialize("API_KEY","SECRET_KEY");
App42API::initialize("API_KEY","SECRET_KEY"); 
App42API::Initialize("APP_KEY", "SECRET_KEY");
api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") 
App42API.initialize("API_KEY","SECRET_KEY");
Coming Soon

Build Service

After initialization, developer needs to call the buildXXXService method on App42API to get the instance of the particular API that you 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 J2ME
  • 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
EmailService emailService = App42API.buildEmailService(); 
EmailService emailService = App42API.BuildEmailService();  
EmailService *emailService = [App42API buildEmailService]; 
EmailService emailService = App42API.buildEmailService(); 
EmailService emailService = App42API.buildEmailService(); 
EmailService emailService = App42API.BuildEmailService();
var emailService  = new App42Email();
local emailService  = App42API:buildEmailService()
EmailService *emailService = App42API::BuildEmailService();
EmailService emailService = App42API.BuildEmailService(); 
$emailService = App42API::buildEmailService(); 
EmailService *emailService = App42API::BuildEmailService();
email_service = api.build_email_service()
var emailService:EmailService = App42API.buildEmailService(); 
Coming Soon

Create Email Configuration

Creates Email Configuration using which in future the App developer can send mail.

Required Parameters

emailHost - Email Host to be used for sending mail. emailPort - Email Port to be used for sending mail. emailId - Email id to be used for sending mail. password - Email Password to be used for sending mail. 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 J2ME
  • 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
String emailHost = "smtp.gmail.com";
int emailPort = 465;
String emailId = "nick@gmail.com";
String password = "********";
boolean isSSL = true;						
emailService.createMailConfiguration(emailHost, emailPort,emailId, password, isSSL, new App42CallBack() {
public void onSuccess(Object response) 
{
	Email email = (Email)response;
	ArrayList<Email.Configuration> configList = email.getConfigList();     
	for(Email.Configuration  config : configList)  
	{    
		System.out.println("emailId is " + config.getEmailId());  
		System.out.println("Host is " + config.getHost());  
		System.out.println("Port is " + config.getPort());     
		System.out.println("SSL is " + config.getSsl()); 
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
	String emailHost = "smtp.gmail.com";
	int emailPort = 465;
	String emailId = "nick@gmail.com";
	String password = "********";
	boolean isSSL = true;						
	emailService.CreateMailConfiguration(emailHost,emailPort,emailId,password,isSSL,new Callback());
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Email email = (Email) response;   
		Console.WriteLine("emailId is " + email.GetConfigList()[0].GetEmailId());
		Console.WriteLine("Host is " + email.GetConfigList()[0].GetHost());  
		String jsonResponse = email.ToString();  
	}  
}  
NSString *emailHost = @"smtp.gmail.com";
int *emailPort =  465;
NSString *emailId =  @"nick@gmail.com";
NSString *password =  @"********";
BOOL isSSL = true;
Email *email = [emailService createEmailConfiguration:emailHost emailPort:emailPort emailId:emailId emailPassword:password isSSL:isSSL]; 
NSLog(@"emailId is  %@" , [(Configuration *)[email.configurationArray objectAtIndex:0] emailId);
NSLog(@"Host is  %@" ,   [(Configuration *)[email.configurationArray objectAtIndex:0] host);
NSString jsonResponse = [email toString];
String emailHost = "smtp.gmail.com";
int emailPort = 465;
String emailId = "nick@gmail.com";
String password = "********";
boolean isSSL = true;						
Email email =  emailService.createMailConfiguration(emailHost,emailPort,emailId,password,isSSL);
System.out.println("emailId is " + ((Email.Configuration)email.getConfigList().elementAt(0)).getEmailId());
System.out.println("Host is " + ((Email.Configuration)email.getConfigList().elementAt(0)).getHost());
String jsonResponse = email.toString();
String emailHost = "smtp.gmail.com";
int emailPort = 465;
String emailId = "nick@gmail.com";
String password = "********";
boolean isSSL = true;						
Email email =  emailService.createMailConfiguration(emailHost,emailPort,emailId,password,isSSL);
ArrayList<Email.Configuration> configList = email.getConfigList();     
for(Email.Configuration  config : configList)  
{    
	System.out.println("emailId is " + config.getEmailId());  
	System.out.println("Host is " + config.getHost());  
	System.out.println("Port is " + config.getPort());     
	System.out.println("SSL is " + config.getSsl()); 
} 
String jsonResponse = email.toString();
String emailHost = "smtp.gmail.com";
int emailPort = 465;
String emailId = "nick@gmail.com";
String password = "********";
boolean isSSL = true;	
App42Log.SetDebug(true);		//Print output in your editor console					
emailService.CreateMailConfiguration(emailHost,emailPort,emailId,password,isSSL, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
`
var emailHost = "smtp.gmail.com",
emailPort = 465
emailId = "nick@gmail.com"
password = "********"
isSSL = true
result ;  
emailService.createMailConfiguration(emailHost,emailPort,emailId,password,isSSL,{
	success: function(object) 
	{  
		var email = JSON.parse(object);  
		result = email.app42.response.email.configurations.config;
		console.log("Email id is " + result.emailId);
		console.log("Host is  " + result.host);
		console.log("Port is " + result.port);
		console.log("Ssl is " + result.ssl);
	},  
	error: function(error) {  
	}  
});
local emailHost = "smtp.gmail.com"
local emailPort = 465
local emailId = "nick@gmail.com"
local password = "********"
local isSSL = true
local App42CallBack = {}
emailService:createMailConfiguration(emailHost, emailPort,emailId, password ,isSSL, App42CallBack)
function App42CallBack:onSuccess(object) 
	print("emailId is "..object:getConfigList():getEmailId())  
	print("Host is " ..object:getConfigList():getHost());    
	print("Port is "..object:getConfigList():getPort());       
	print(object:getConfigList():getSsl());   
end  
function App42CallBack:onException(object)
	print("Message is "..object:getAppErrorCode()); 
	print("Message is "..object:getHttpErrorCode()); 
	print("Message is "..object:getMessage()); 
	print("Message is "..object:getDetails()); 
end
string emailHost = "smtp.gmail.com";
int emailPort = 465;
string emailId = "nick@gmail.com";
string password = "********";
bool isSSL = true;

emailService->createMailConfiguration(emailHost.c_str(), emailPort, emailId.c_str(), password.c_str(), isSSL, this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));

void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
{
    App42EmailResponse *emailResponse = (App42EmailResponse*)response;
    printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
    printf("\nResponse Body=%s",emailResponse->getBody().c_str());

    if(emailResponse->isSuccess)
    {
        for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it)
        {
            printf("\n EmailId=%s",it->emailId.c_str());
            printf("\n Host=%s",it->host.c_str());
            printf("\n Port=%d",it->port);
            printf("\n SSL=%d",it->ssl);
        }
    }
    
    else
    {
        printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",emailResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
    }
}
String emailHost = "smtp.gmail.com";
int emailPort = 465;
String emailId = "nick@gmail.com";
String password = "********";
boolean isSSL = true;						
Email email =  emailService.CreateMailConfiguration(emailHost,emailPort,emailId,password,isSSL);
Console.WriteLine("emailId is " + email.GetConfigList()[0].GetEmailId());
Console.WriteLine("Host is " + email.GetConfigList()[0].GetHost());  
String jsonResponse = email.ToString();    
$emailHost = "smtp.gmail.com";
$emailPort = 465;
$emailId = "nick@gmail.com";
$password = "********";
$isSSL = "true";		
$email = $emailService->createMailConfiguration($emailHost, $emailPort, $emailId,$password,$isSSL); 
$configList = $email->getConfigList();
foreach($configList as $config)
{
	print_r("emailId is " . $config->getEmailId());
	print_r("Host is " . $config->getHost());
	print_r("Port is " . $config->getPort());
	print_r("SSL is " . $config->getSsl());
}
$jsonResponse = $email->toString();
string emailHost = "smtp.gmail.com";
int emailPort = 465;
string emailId = "nick@gmail.com";
string password = "********";
bool isSSL = true;

emailService->createMailConfiguration(emailHost.c_str(), emailPort, emailId.c_str(), password.c_str(), isSSL, this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));

void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
{
    App42EmailResponse *emailResponse = (App42EmailResponse*)response;
    printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
    printf("\nResponse Body=%s",emailResponse->getBody().c_str());

    if(emailResponse->isSuccess)
    {
        for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it)
        {
            printf("\n EmailId=%s",it->emailId.c_str());
            printf("\n Host=%s",it->host.c_str());
            printf("\n Port=%d",it->port);
            printf("\n SSL=%d",it->ssl);
        }
    }
    
    else
    {
        printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",emailResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
    }
}
emailHost = "smtp.gmail.com";
emailPort = 465;
emailId = "nick@gmail.com";
password = "********";
isSSL = true;						
email = email_service.create_mail_configuration(emailHost,emailPort,emailId,password,isSSL);  
config_list = Array.new();
config_list = email.config_list();  
for config in config_list do
  puts "emailId is #{config.emailId}";
  puts "host is #{config.emailHost}";
  puts "port is #{config.emailPort}";
end
json_response = email.to_s();
var emailHost:String = "smtp.gmail.com";  
var emailPort:int = 465;  
var emailId:String = "nick@gmail.com";  
var password:String = "********";  
var isSSL:Boolean = true;  
emailService.createMailConfiguration(emailHost, emailPort, emailId, password, isSSL,new callback());
class callback implements App42CallBack
{	
	public function onException(exception:App42Exception):void
	{
		trace("Exception Message " + exception);
	}
	public function onSuccess(response:Object):void
	{
		var emailObject:Email = Email(response);		
		var configList:Array = emailObject.getConfigList();
		for(var i:int=0;i<configList.length;i++){
			trace("EmailId is : " + Configuration(configList[i]).getEmailId());
			trace("Host is : " + Configuration(configList[i]).getHost());
			trace("SSL is : " + Configuration(configList[i]).getSsl());
			trace("Port is : " + Configuration(configList[i]).getPort());
		}
	}
}
Coming Soon 

Get Email Configuration

Gets 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 J2ME
  • 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
emailService.getEmailConfigurations(new App42CallBack() {
public void onSuccess(Object response) 
{
	Email email = (Email)response;
	ArrayList<Email.Configuration> configList = email.getConfigList();     
	for(Email.Configuration  config : configList)  
	{    
	System.out.println("emailId is " + config.getEmailId());  
	System.out.println("Host is " + config.getHost());  
	System.out.println("Port is " + config.getPort());     
	System.out.println("SSL is " + config.getSsl()); 
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
emailService.GetEmailConfigurations(new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{  
		Email email = (Email) response;    
		Console.WriteLine("emailId is " + email.GetConfigList()[0].GetEmailId());
		Console.WriteLine("Host is " + email.GetConfigList()[0].GetHost());   
		String jsonResponse = email.ToString();  
	}  
} 
Email *email = [emailService getEmailConfiguration] 
NSLog(@"emailId is  %@" , [(Configuration *)[email.configurationArray objectAtIndex:0] emailId);
NSLog(@"Host is  %@" ,   [(Configuration *)[email.configurationArray objectAtIndex:0] host);
NSString jsonResponse = [email toString];
Email email = emailService.getEmailConfigurations(); 
System.out.println("emailId is " + ((Email.Configuration)email.getConfigList().elementAt(0)).getEmailId());
System.out.println("Host is " + ((Email.Configuration)email.getConfigList().elementAt(0)).getHost());
String jsonResponse = email.toString();   
Email email = emailService.getEmailConfigurations(); 
ArrayList<Email.Configuration> configList = email.getConfigList();     
for(Email.Configuration  config : configList)  
{    
	System.out.println("emailId is " + config.getEmailId());  
	System.out.println("Host is " + config.getHost());  
	System.out.println("Port is " + config.getPort());     
	System.out.println("SSL is " + config.getSsl()); 
} 
String jsonResponse = email.toString();
App42Log.SetDebug(true);		//Print output in your editor console
emailService.getEmailConfigurations(new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
`
var result ;  
emailService.getEmailConfigurations({
	success: function(object) 
	{  
		var email = JSON.parse(object);  
		result = email.app42.response.email.configurations.config;
		if(result.length == undefined)  
		{  
			console.log("Email id is " + result.emailId);
			console.log("Host is  " + result.host);
			console.log("Port is " + result.port);
			console.log("Ssl is " + result.ssl);
		}  
		else  
			for(var i = 0; i<result.length; i++)
			{ 
				console.log("Email id is " + result[i].emailId);
				console.log("Host is  " + result[i].host);
				console.log("Port is " + result[i].port);
				console.log("Ssl is " + result[i].ssl);								
			}  		
	},  
	error: function(error) {  
	}  
});
local App42CallBack = {}
emailService:getEmailConfigurations(App42CallBack)
function App42CallBack:onSuccess(object));
	if table.getn(object:getConfigList()) >1 then   
		for m=1,table.getn(object:getConfigList()) do
			print("emailId is "..object:getConfigList()[m]:getEmailId())  
			print("Host is " .. object:getConfigList()[m]:getHost());    
			print("Port is "..object:getConfigList()[m]:getPort());       
			print(object:getConfigList()[m]:getSsl());  
		end
	else
		print("emailId is "..object:getConfigList():getEmailId())  
		print("Host is " ..object:getConfigList():getHost());    
		print("Port is "..object:getConfigList():getPort());       
		print(object:getConfigList():getSsl());  
	end
end  
function App42CallBack:onException(object)
	print("Message is "..object:getAppErrorCode()); 
	print("Message is "..object:getHttpErrorCode()); 
	print("Message is "..object:getMessage()); 
	print("Message is "..object:getDetails()); 
end
emailService->getEmailConfigurations(this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));
void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
{
     App42EmailResponse *emailResponse = (App42EmailResponse*)response;
     printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
     printf("\nResponse Body=%s",emailResponse->getBody().c_str());
     
     if(emailResponse->isSuccess)
     {
         for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it)
         {
             printf("\n EmailId=%s",it->emailId.c_str());
             printf("\n Host=%s\n",it->host.c_str());
             printf("\n Port=%d\n",it->port);
             printf("\n SSL=%d\n",it->ssl);
         }
     }
     else
     {
 
         printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
         printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
         printf("\nappErrorCode:%d",emailResponse->appErrorCode);
         printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
     }
}
Email email = emailService.getEmailConfigurations(); 
Console.WriteLine("emailId is " + email.GetConfigList()[0].GetEmailId());
Console.WriteLine("Host is " + email.GetConfigList()[0].GetHost());  
String jsonResponse = email.ToString();       
$email = $emailService->getEmailConfigurations(); 
$configList = $email->getConfigList();
foreach($configList as $config)
{
	print_r("emailId is " . $config->getEmailId());
	print_r("Host is " . $config->getHost());
	print_r("Port is " . $config->getPort());
	print_r("SSL is " . $config->getSsl());
}
$jsonResponse = $email->toString();
emailService->getEmailConfigurations(this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));
void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
{
	App42EmailResponse *emailResponse = (App42EmailResponse*)response;
	printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
	printf("\nResponse Body=%s",emailResponse->getBody().c_str());

	if(emailResponse->isSuccess)
	{
		for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it)
		{
			printf("\n EmailId=%s",it->emailId.c_str());
			printf("\n Host=%s\n",it->host.c_str());
			printf("\n Port=%d\n",it->port);
			printf("\n SSL=%d\n",it->ssl);
		}
		}
		else
		{
			printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
			printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
			printf("\nappErrorCode:%d",emailResponse->appErrorCode);
			printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
	}
}
email = email_service.get_email_configurations();  
config_list = Array.new();
config_list = email.config_list(); 
for config in config_list do
  puts "emailId is #{config.email_id}";
  puts "host is #{config.host}";
  puts "port is #{config.port}";
end
json_response = email.to_s();
emailService.getEmailConfigurations(new callback());
class callback implements App42CallBack{
	
	public function onSuccess(response:Object):void
	{
		var emailObject:Email = Email(response);		
		var configList:Array = emailObject.getConfigList();
		for(var i:int=0;i<configList.length;i++){
			trace("EmailId is : " + Configuration(configList[i]).getEmailId());
			trace("Host is : " + Configuration(configList[i]).getHost());
			trace("SSL is : " + Configuration(configList[i]).getSsl());
			trace("Port is : " + Configuration(configList[i]).getPort());
		}
	}
	public function onException(exception:App42Exception):void
	{
		trace("Exception Message " + exception);
	}
} 
Coming Soon 

Send Email

Send the email to user to whom you want to send , Email will be send from configuration 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 e.g. 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 J2ME
  • 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
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";	
EmailMIME emailMime=EmailMIME.PLAIN_TEXT_MIME_TYPE;
emailService.sendMail(sendTo,sendSubject, sendMsg, senderEmailId, EmailMIME.PLAIN_TEXT_MIME_TYPE, new App42CallBack() {
public void onSuccess(Object response)
{
	Email emailObject = (Email)response;
	System.out.println("Email From is : " +emailObject.getFrom());
	System.out.println("email To is : " +emailObject.getTo());
	System.out.println("Subject is : " + emailObject.getSubject());
	System.out.println("Message Body is : " + emailObject.getBody());
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";
String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE";			
emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime,new Callback());
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{ 
		Email email = (Email) response;   
		Console.WriteLine("emailId is " + email.GetFrom());
		Console.WriteLine("subject is " + email.GetSubject());  
		String jsonResponse = email.ToString();    
	}  
}  
NSString *sendTo = @"john@shephertz.co.in";
NSString *sendSubject  = @"Feedback";
NSString *sendMsg = @"Your message";
NSString *senderEmailId = @"nick@gmail.com";
NSString *emailMime = @"EmailMIME.PLAIN_TEXT_MIME_TYPE";
Email *email = [emailService sendMail:sendTo subject:sendSubject Message:sendMsg fromEmail:senderEmailId emailMIME:emailMime];
NSLog(@"from is   %@" , email.from);
NSLog(@"to is  %@" ,  email.to);
NSString jsonResponse = [email toString];
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";	
EmailMIME emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE";				
Email email =  emailService.sendMail(sendTo, sendSubject, sendMsg, senderEmailId, EmailMIME.PLAIN_TEXT_MIME_TYPE);
System.out.println("emailId is " + email.getFrom());
System.out.println("subject is " + email.getSubject());
String jsonResponse = email.toString();
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";	
EmailMIME emailMime=EmailMIME.PLAIN_TEXT_MIME_TYPE;			
Email emailObject =  emailService.sendMail(sendTo, sendSubject, sendMsg, senderEmailId,emailMime);
System.out.println("Email From is : " +emailObject.getFrom());
System.out.println("email To is : " +emailObject.getTo());
System.out.println("Subject is : " + emailObject.getSubject());
System.out.println("Message Body is : " + emailObject.getBody());
String jsonResponse = emailObject.toString();
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";
String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE";	
App42Log.SetDebug(true);		//Print output in your editor console				
emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
`
var sendTo = "john@shephertz.co.in",
senderEmailId = "nick@gmail.com",
sendSubject = "Feedback",
sendMsg = "Your message",
result;
emailService.sendMail(sendTo,sendSubject,sendMsg,senderEmailId,"text/plain",{
	success: function(object) {
	var email = JSON.parse(object);
	result =email.app42.response.email;
	console.log("email id " + result.body);
	console.log("from id " + result.from);
	console.log("subject  " + result.subject);
	console.log("subject  " + result.to);
	},
	error: function(error) {  
	}  
}); 
local sendTo = "john@shephertz.co.in";
local senderEmailId = "nick@gmail.com";
local sendSubject = "Feedback";
local sendMsg = "Your message";
local App42CallBack = {}
require("App42-Lua-API.EmailMIME") 
emailService:sendMail(sendTo,sendSubject, sendMsg, emailId, EmailMIME.PLAIN_TEXT_MIME_TYPE,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Email From is : " ..object:getFrom());  
	print("email To is : " ..object:getTo());  
	print("Subject is : " ..object:getSubject());  
	print("Message Body is : "..object:getBody());  
end  
function App42CallBack:onException(object)
	print("Message is "..object:getAppErrorCode()); 
	print("Message is "..object:getHttpErrorCode()); 
	print("Message is "..object:getMessage()); 
	print("Message is "..object:getDetails()); 
end
string sendTo = "john@shephertz.co.in";
string senderEmailId = "nick@gmail.com";
string sendSubject = "Feedback";
string sendMsg = "Your message";
EmailMIME emailMime = PLAIN_TEXT_MIME_TYPE;
emailService->sendMail(sendTo.c_str(), sendSubject.c_str(), sendMsg.c_str(),senderEmailId.c_str(),emailMime,this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));
void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
{
    App42EmailResponse *emailResponse = (App42EmailResponse*)response;
    printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
    printf("\nResponse Body=%s",emailResponse->getBody().c_str());

    if(emailResponse->isSuccess)
    {
        printf("\n From=%s",emailResponse->from.c_str());
        printf("\n To=%s",emailResponse->to.c_str());
        printf("\n Subject=%s",emailResponse->subject.c_str());
        printf("\n Body=%s",emailResponse->body.c_str());
    }
    
    else
    {
        printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",emailResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
    }
}
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";	
String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE";				
Email email =  emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime);
Console.WriteLine("emailId is " + email.GetFrom());
Console.WriteLine("Host is " + email.GetSubject());  
String jsonResponse = email.ToString();    
$sendTo = "john@shephertz.co.in";
$sendSubject  = "Feedback";
$sendMsg = "Your message";
$senderEmailId = "nick@gmail.com";		
$emailMime = EmailMIME::PLAIN_TEXT_MIME_TYPE;		
$email = $emailService->sendMail($senderEmailId, $sendTo, $sendSubject, $sendMsg, $emailMime); 
print_r("Email From is : " .$email->getFrom());
print_r("email To is : " .$email->getTo());
print_r("Subject is : " .$email->getSubject());
print_r("Message Body is : " .$email->getBody());
$jsonResponse = $email->toString();
string sendTo = "john@shephertz.co.in";
string senderEmailId = "nick@gmail.com";
string sendSubject = "Feedback";
string sendMsg = "Your message";
EmailMIME emailMime = PLAIN_TEXT_MIME_TYPE;
emailService->sendMail(sendTo.c_str(), sendSubject.c_str(), sendMsg.c_str(),senderEmailId.c_str(),emailMime,this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));
void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
{
    App42EmailResponse *emailResponse = (App42EmailResponse*)response;
    printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
    printf("\nResponse Body=%s",emailResponse->getBody().c_str());

    if(emailResponse->isSuccess)
    {
        printf("\n From=%s",emailResponse->from.c_str());
        printf("\n To=%s",emailResponse->to.c_str());
        printf("\n Subject=%s",emailResponse->subject.c_str());
        printf("\n Body=%s",emailResponse->body.c_str());
    }
    
    else
    {
        printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",emailResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
    }
}
sendTo =  "john@shephertz.co.in";
sendSubject = "Here we are sending an Email";
sendMsg = "Body of message";
senderEmailId = "nick@gmail.com";
emailMime = App42::Email::EmailMIME.new();			
email_mime_type = emailMime.enum("PLAIN_TEXT_MIME_TYPE");
email = email_service.send_mail(sendTo, sendSubject, sendMsg, senderEmailId, email_mime_type);  
puts "from  #{email.from}";
puts "to #{email.to}";
puts "subject is #{email.subject}";
puts "body #{email.body}";
json_response = email.to_s();
var sendTo:String = "john@shephertz.co.in";  
var sendSubject:String  = "Feedback";  
var sendMsg:String = "Your message";  
var senderEmailId:String = "nick@gmail.com"; 
var emailMime:String="EmailMIME.PLAIN_TEXT_MIME_TYPE";	
emailService.sendMail(sendTo,sendSubject, sendMsg, senderEmailId,emailMime ,new callback());
class callback implements App42CallBack
{
	public function onSuccess(response:Object):void
	{
		var emailObject:Email = Email(response);	
		trace("Email From is : " +emailObject.getFrom());
		trace("email To is : " +emailObject.getTo());
		trace("Subject is : " + emailObject.getSubject());
		trace("Message Body is : " + emailObject.getBody());
  
		
	}
	public function onException(exception:App42Exception):void
	{
		trace("Exception Message " + exception);
	}
}
Coming Soon 

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 J2ME
  • 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
String emailId = "nick@gmail.com";
emailService.removeEmailConfiguration( emailId, new App42CallBack() {
public void onSuccess(Object response)
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
}); 
String emailId = "nick@gmail.com";
emailService.RemoveEmailConfiguration(emailId, new Callback());  
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{ 
		App42Response success = (App42Response) response;     
		String jsonResponse = success.ToString();  
	}  
}  
NSString *emailId = @"nick@gmail.com";
App42Response *response = [emailService removeEmailConfiguration:emailId]; 
NSString *success = response.isResponseSuccess;
NSString *jsonResponse = [response toString];                             
String emailId = "nick@gmail.com";
App42Response response = emailService.removeEmailConfiguration(emailId); 
boolean  success = response.isResponseSuccess();
String jsonResponse = response.toString(); 
String emailId = "nick@gmail.com";
App42Response app42response = emailService.removeEmailConfiguration(emailId); 
System.out.println("response is " + app42response) ;  
boolean  success = app42response.isResponseSuccess();
String jsonResponse = app42response.toString(); 
String emailId = "nick@gmail.com";
App42Log.SetDebug(true);		//Print output in your editor console
emailService.RemoveEmailConfiguration(emailId,new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
`
var emailId = "nick@gmail.com",
result;
emailService.removeEmailConfiguration(emailId,{
	success: function(object) {
	var email = JSON.parse(object);  
		result = email.app42.response.email.configurations.config;
		console.log("Email id is " + result.emailId);
		console.log("Host is  " + result.host);
		console.log("Port is " + result.port);
		console.log("Ssl is " + result.ssl);
	},
	error: function(error) {
	}
}); 
local emailId = "nick@gmail.com";
local App42CallBack = {}
emailService:removeEmailConfiguration(emailId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Response is "..object:getStrResponse());
end  
function App42CallBack:onException(object)
	print("Message is "..object:getAppErrorCode()); 
	print("Message is "..object:getHttpErrorCode()); 
	print("Message is "..object:getMessage()); 
	print("Message is "..object:getDetails()); 
end
string emailId = "nick@gmail.com";
emailService->removeEmailConfiguration(emailId.c_str(),this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));

void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
 {
     App42EmailResponse *emailResponse = (App42EmailResponse*)response;
     printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
     printf("\nResponse Body=%s",emailResponse->getBody().c_str());
     
     if(emailResponse->isSuccess)
     {
         for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it)
         {
             printf("\n EmailId=%s",it->emailId.c_str());
             printf("\n Host=%s\n",it->host.c_str());
             printf("\n Port=%d\n",it->port);
             printf("\n SSL=%d\n",it->ssl);
         }
     }
     else
     {
 
         printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
         printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
         printf("\nappErrorCode:%d",emailResponse->appErrorCode);
         printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
     }
 }
String emailId = "nick@gmail.com";
App42Response response = emailService.RemoveEmailConfiguration(emailId); 
Boolean  success = response.IsResponseSuccess();
String jsonResponse = response.ToString(); 
$emailId = "nick@gmail.com";
$response = $emailService->removeEmailConfiguration($emailId); 
print_r("Response is : ". $response->toString());
$success = $response->isResponseSuccess();
$jsonResponse = $response->toString(); 
string emailId = "nick@gmail.com";
emailService->removeEmailConfiguration(emailId.c_str(),this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));

void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
 {
     App42EmailResponse *emailResponse = (App42EmailResponse*)response;
     printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
     printf("\nResponse Body=%s",emailResponse->getBody().c_str());
     
     if(emailResponse->isSuccess)
     {
         for(std::vector<App42Configuration>::iterator it = emailResponse->configurationArray.begin(); it != emailResponse->configurationArray.end(); ++it)
         {
             printf("\n EmailId=%s",it->emailId.c_str());
             printf("\n Host=%s\n",it->host.c_str());
             printf("\n Port=%d\n",it->port);
             printf("\n SSL=%d\n",it->ssl);
         }
     }
     else
     {
 
         printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
         printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
         printf("\nappErrorCode:%d",emailResponse->appErrorCode);
         printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
     }
 }
emailId = "nick@gmail.com";							
response = email_service.remove_email_configuration(emailId);
success = response.is_response_success();
json_response = email.to_s();
var emailId:String = "nick@gmail.com";
emailService.removeEmailConfiguration(emailId,new callback());
class callback implements App42CallBack{
	
	public function onSuccess(response:Object):void
	{
		var app42response :App42Response= App42Response(response);      
		trace("response is " + app42response)   
		
	}
	public function onException(exception:App42Exception):void
	{
		trace("Exception Message " + exception);
	}
}
Coming Soon 

Send Email With Custom Email Template

Send the email to user to whom you want to send , Email will be send from configuration 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 e.g. 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 J2ME
  • 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
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";	
EmailMIME emailMime=EmailMIME.PLAIN_TEXT_MIME_TYPE;
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("template", "Your Template Name");//Which you are created from AppHQ.
emailService.setOtherMetaHeaders(otherMetaHeaders);
emailService.sendMail(sendTo,sendSubject, sendMsg, senderEmailId, EmailMIME.PLAIN_TEXT_MIME_TYPE, new App42CallBack() {
public void onSuccess(Object response)
{
	Email emailObject = (Email)response;
	System.out.println("Email From is : " +emailObject.getFrom());
	System.out.println("email To is : " +emailObject.getTo());
	System.out.println("Subject is : " + emailObject.getSubject());
	System.out.println("Message Body is : " + emailObject.getBody());
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());
}
});
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";
String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("template", "Your Template Name");//Which you are created from AppHQ.
emailService.SetOtherMetaHeaders(otherMetaHeaders);			
emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime,new Callback());
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
	}  
	public void OnSuccess(Object response)  
	{ 
		Email email = (Email) response;   
		Console.WriteLine("emailId is " + email.GetFrom());
		Console.WriteLine("subject is " + email.GetSubject());  
		String jsonResponse = email.ToString();    
	}  
}  
NSString *sendTo = @"john@shephertz.co.in";
NSString *sendSubject  = @"Feedback";
NSString *sendMsg = @"Your message";
NSString *senderEmailId = @"nick@gmail.com";
NSString *emailMime = @"EmailMIME.PLAIN_TEXT_MIME_TYPE";
NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Your Template Name",@"template", nil];//Which you are created from AppHQ.
[emailService setOtherMetaHeaders:otherMetaHeaders];
Email *email = [emailService sendMail:sendTo subject:sendSubject Message:sendMsg fromEmail:senderEmailId emailMIME:emailMime];
NSLog(@"from is   %@" , email.from);
NSLog(@"to is  %@" ,  email.to);
NSString jsonResponse = [email toString];
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";	
EmailMIME emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE";
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("template", "Your Template Name");//Which you are created from AppHQ.
emailService.setOtherMetaHeaders(otherMetaHeaders);				
Email email =  emailService.sendMail(sendTo, sendSubject, sendMsg, senderEmailId, EmailMIME.PLAIN_TEXT_MIME_TYPE);
System.out.println("emailId is " + email.getFrom());
System.out.println("subject is " + email.getSubject());
String jsonResponse = email.toString();
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";	
EmailMIME emailMime=EmailMIME.PLAIN_TEXT_MIME_TYPE;		
HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("template", "Your Template Name");//Which you are created from AppHQ.
emailService.setOtherMetaHeaders(otherMetaHeaders);	
Email emailObject =  emailService.sendMail(sendTo, sendSubject, sendMsg, senderEmailId,emailMime);
System.out.println("Email From is : " +emailObject.getFrom());
System.out.println("email To is : " +emailObject.getTo());
System.out.println("Subject is : " + emailObject.getSubject());
System.out.println("Message Body is : " + emailObject.getBody());
String jsonResponse = emailObject.toString();
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";
String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE";	
App42Log.SetDebug(true);		//Print output in your editor console	
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("template", "Your Template Name");//Which you are created from AppHQ.
emailService.SetOtherMetaHeaders(otherMetaHeaders);				
emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
	public void OnSuccess(object response)
	{
		App42Log.Console("Success : " + response);
	}

	public void OnException(Exception e)
	{
		App42Log.Console("Exception : " + e);
	}
}
`
var sendTo = "john@shephertz.co.in",
senderEmailId = "nick@gmail.com",
sendSubject = "Feedback",
sendMsg = "Your message",
result;
var otherMetaHeaders = {"template":"Your Template Name"}; //Which you are created from AppHQ.                              
emailService.setOtherMetaHeaders(otherMetaHeaders); 
emailService.sendMail(sendTo,sendSubject,sendMsg,senderEmailId,"text/plain",{
	success: function(object) {
	var email = JSON.parse(object);
	result =email.app42.response.email;
	console.log("email id " + result.body);
	console.log("from id " + result.from);
	console.log("subject  " + result.subject);
	console.log("subject  " + result.to);
	},
	error: function(error) {  
	}  
}); 
local sendTo = "john@shephertz.co.in";
local senderEmailId = "nick@gmail.com";
local sendSubject = "Feedback";
local sendMsg = "Your message";
local App42CallBack = {}
require("App42-Lua-API.EmailMIME") 
local otherMetaHeaders = {};
otherMetaHeaders.template= "Your Template Name";//Which you are created from AppHQ.
emailService:setOtherMetaHeaders(otherMetaHeaders);
emailService:sendMail(sendTo,sendSubject, sendMsg, emailId, EmailMIME.PLAIN_TEXT_MIME_TYPE,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Email From is : " ..object:getFrom());  
	print("email To is : " ..object:getTo());  
	print("Subject is : " ..object:getSubject());  
	print("Message Body is : "..object:getBody());  
end  
function App42CallBack:onException(object)
	print("Message is "..object:getAppErrorCode()); 
	print("Message is "..object:getHttpErrorCode()); 
	print("Message is "..object:getMessage()); 
	print("Message is "..object:getDetails()); 
end
string sendTo = "john@shephertz.co.in";
string senderEmailId = "nick@gmail.com";
string sendSubject = "Feedback";
string sendMsg = "Your message";
EmailMIME emailMime = PLAIN_TEXT_MIME_TYPE;
map<string,string>otherMetaHeaders;
otherMetaHeaders["template"] = "Your Template Name";//Which you are created from AppHQ.
emailService->setOtherMetaHeaders(otherMetaHeaders); 
emailService->sendMail(sendTo.c_str(), sendSubject.c_str(), sendMsg.c_str(),senderEmailId.c_str(),emailMime,this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));
void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
{
    App42EmailResponse *emailResponse = (App42EmailResponse*)response;
    printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
    printf("\nResponse Body=%s",emailResponse->getBody().c_str());

    if(emailResponse->isSuccess)
    {
        printf("\n From=%s",emailResponse->from.c_str());
        printf("\n To=%s",emailResponse->to.c_str());
        printf("\n Subject=%s",emailResponse->subject.c_str());
        printf("\n Body=%s",emailResponse->body.c_str());
    }
    
    else
    {
        printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",emailResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
    }
}
String sendTo = "john@shephertz.co.in";
String sendSubject  = "Feedback";
String sendMsg = "Your message";
String senderEmailId = "nick@gmail.com";	
String emailMime="EmailMIME.PLAIN_TEXT_MIME_TYPE";
Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("template", "Your Template Name");//Which you are created from AppHQ.
emailService.SetOtherMetaHeaders(otherMetaHeaders);								
Email email =  emailService.SendMail(sendTo, sendSubject, sendMsg, senderEmailId, emailMime);
Console.WriteLine("emailId is " + email.GetFrom());
Console.WriteLine("Host is " + email.GetSubject());  
String jsonResponse = email.ToString();    
$sendTo = "john@shephertz.co.in";
$sendSubject  = "Feedback";
$sendMsg = "Your message";
$senderEmailId = "nick@gmail.com";		
$emailMime = EmailMIME::PLAIN_TEXT_MIME_TYPE;	
$otherMetaHeaders = array();
$otherMetaHeaders['template'] ="Your Template Name";//Which you are created from AppHQ.
$emailService->setOtherMetaHeaders($otherMetaHeaders);	
$email = $emailService->sendMail($senderEmailId, $sendTo, $sendSubject, $sendMsg, $emailMime); 
print_r("Email From is : " .$email->getFrom());
print_r("email To is : " .$email->getTo());
print_r("Subject is : " .$email->getSubject());
print_r("Message Body is : " .$email->getBody());
$jsonResponse = $email->toString();
string sendTo = "john@shephertz.co.in";
string senderEmailId = "nick@gmail.com";
string sendSubject = "Feedback";
string sendMsg = "Your message";
EmailMIME emailMime = PLAIN_TEXT_MIME_TYPE;
map<string,string>otherMetaHeaders;
otherMetaHeaders["template"] = "Your Template Name";//Which you are created from AppHQ.
emailService->setOtherMetaHeaders(otherMetaHeaders); 
emailService->sendMail(sendTo.c_str(), sendSubject.c_str(), sendMsg.c_str(),senderEmailId.c_str(),emailMime,this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));
void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
{
    App42EmailResponse *emailResponse = (App42EmailResponse*)response;
    printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
    printf("\nResponse Body=%s",emailResponse->getBody().c_str());

    if(emailResponse->isSuccess)
    {
        printf("\n From=%s",emailResponse->from.c_str());
        printf("\n To=%s",emailResponse->to.c_str());
        printf("\n Subject=%s",emailResponse->subject.c_str());
        printf("\n Body=%s",emailResponse->body.c_str());
    }
    
    else
    {
        printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
        printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
        printf("\nappErrorCode:%d",emailResponse->appErrorCode);
        printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
    }
}
Coming Soon
var sendTo:String = "john@shephertz.co.in";  
var sendSubject:String  = "Feedback";  
var sendMsg:String = "Your message";  
var senderEmailId:String = "nick@gmail.com"; 
var emailMime:String="EmailMIME.PLAIN_TEXT_MIME_TYPE";
var otherMetaHeaders:Dictionary = new Dictionary();
otherMetaHeaders["template"] = "Your Template Name";
emailService.setOtherMetaHeaders(otherMetaHeaders);	
emailService.sendMail(sendTo,sendSubject, sendMsg, senderEmailId,emailMime ,new callback());
class callback implements App42CallBack
{
	public function onSuccess(response:Object):void
	{
		var emailObject:Email = Email(response);	
		trace("Email From is : " +emailObject.getFrom());
		trace("email To is : " +emailObject.getTo());
		trace("Subject is : " + emailObject.getSubject());
		trace("Message Body is : " + emailObject.getBody());
  
		
	}
	public function onException(exception:App42Exception):void
	{
		trace("Exception Message " + exception);
	}
}
Coming Soon 

Exception Handling

The functions available under Email API can throw some exceptions in abnormal conditions. An example of the same has been given below. E.g. If an app 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 J2ME
  • 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
String emailId = "nick@gmail.com";			
emailService.removeEmailConfiguration( emailId, new App42CallBack() {
public void onSuccess(Object response) 
{
	App42Response app42response = (App42Response)response;      
	System.out.println("response is " + app42response) ;  
}
public void onException(Exception ex) 
{
	App42Exception exception = (App42Exception)ex;
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 2303)
	{
	// Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	}
	else if(appErrorCode == 1401)
	{
	// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
	// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage(); 
	}    	   
});                        
String emailId = "nick@gmail.com";
emailService.RemoveEmailConfiguration(emailId, new Callback());
public class Callback : App42Callback  
{  
	public void OnException(App42Exception exception)  
	{  
		Console.WriteLine("Exception Message : " + exception);  
		int appErrorCode = exception.GetAppErrorCode();
		int httpErrorCode = exception.GetHttpErrorCode();
		if(appErrorCode == 2303)
			{
				// Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
			}
			else if(appErrorCode == 1401)
			{
				// handle here for Client is not authorized
			}
			else if(appErrorCode == 1500)
			{
				// handle here for Internal Server Error
			}
		String jsonText = exception.GetMessage(); 
	}  
	public void OnSuccess(Object response)  
	{
		Email email = (Email) response;
		String jsonResponse = email.ToString();  
	} 
}  
					
String *emailId = @"nick@gmail.com";			
try
{
	Email *email =  [emailService removeEmailConfiguration:emailId];
} 
catch(App42Exception *exception)
{
	int appErrorCode = exception.appErrorCode;
	int httpErrorCode = exception.httpErrorCode;
	if(appErrorCode == 2303)
	{
		// Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String *jsonText = exception.reason; 
}
String emailId = "nick@gmail.com";			
try
{
	Email email =  emailService.removeEmailConfiguration(emailId);
} 
catch(App42Exception exception)
{
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 2303)
	{
		// Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage(); 
}
String emailId = "nick@gmail.com";			
try
{
	Email email =  emailService.removeEmailConfiguration(emailId);
} 
catch(App42Exception exception)
{
	int appErrorCode = exception.getAppErrorCode();
	int httpErrorCode = exception.getHttpErrorCode();
	if(appErrorCode == 2303)
	{
		// Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.getMessage(); 
}      
Coming Soon
`
var emailId = "nick@gmail.com",
result;
var appErrorCode ;
emailService.removeEmailConfiguration(emailId,{
    success: function(object) {
    },
    error: function(error) 
    {
        var pushNotification = JSON.parse(object);  
        appErrorCode = pushNotification.app42Fault.appErrorCode;
        if(appErrorCode == 2303)
        {
            // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
        }
        else if(appErrorCode == 1401)
        {
            // handle here for Client is not authorized
        }
        else if(appErrorCode == 1500)
        {
            // handle here for Internal Server Error
        }
    }
});
local emailId = "nick@gmail.com";
local App42CallBack = {}
emailService:removeEmailConfiguration(emailId,App42CallBack)
function App42CallBack:onSuccess(object)
	print("Response is "..object:getStrResponse());
end 
function App42CallBack:onException(exception)
	local appErrorCode = exception:getAppErrorCode()
	if appErrorCode == 2303 then
		-- Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	elseif appErrorCode == 1401 then
		-- handle here for Client is not authorized
	elseif appErrorCode == 1500 then
		-- handle here for Internal Server Error
	end
end
string emailId = "nick@gmail.com";
emailService->removeEmailConfiguration(emailId.c_str(),this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));

void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
 {
     App42EmailResponse *emailResponse = (App42EmailResponse*)response;
     printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
     printf("\nResponse Body=%s",emailResponse->getBody().c_str());
     
     if(emailResponse->isSuccess)
     {
         //Handle success response here
     }
     else
     {
 		// Handle exceptions
         printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
         printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
         printf("\nappErrorCode:%d",emailResponse->appErrorCode);
         printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
         
         if(emailResponse->appErrorCode == 2303)
	     {
		   // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	     }
	     else if(emailResponse->appErrorCode == 1401)
	     {
	    	// handle here for Client is not authorized
	     }
	     else if(emailResponse->appErrorCode == 1500)
	     {
		    // handle here for Internal Server Error
	     }
     }
 }
String emailId = "nick@gmail.com";			
try
{
	Email email =  emailService.RemoveEmailConfiguration(emailId);
} 
catch(App42Exception exception)
{
	int appErrorCode = exception.GetAppErrorCode();
	int httpErrorCode = exception.GetHttpErrorCode();
	if(appErrorCode == 2303)
	{
		// Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	}
	else if(appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if(appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	String jsonText = exception.GetMessage(); 
}        
$emailId = "nick@gmail.com";			
try
{
	$email =  emailService->removeEmailConfiguration(emailId);
} 
catch(App42Exception $exception) 
{
	$appErrorCode =$exception->getAppErrorCode();
	$httpErrorCode = $exception->getHttpErrorCode();
	if($appErrorCode == 2303)
	{
		// Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	}
	else if($appErrorCode == 1401)
	{
		// handle here for Client is not authorized
	}
	else if($appErrorCode == 1500)
	{
		// handle here for Internal Server Error
	}
	   $jsonText = $exception->getMessage(); 
}
string emailId = "nick@gmail.com";
emailService->removeEmailConfiguration(emailId.c_str(),this, app42callfuncND_selector(Sample_Class::onEmailRequestCompleted));

void Sample_Class::onEmailRequestCompleted(App42CallBack *sender, void *response)
 {
     App42EmailResponse *emailResponse = (App42EmailResponse*)response;
     printf("\ncode=%d...%d",emailResponse->getCode(),emailResponse->isSuccess);
     printf("\nResponse Body=%s",emailResponse->getBody().c_str());
     
     if(emailResponse->isSuccess)
     {
         //Handle success response here
     }
     else
     {
 		// Handle exceptions
         printf("\nerrordetails:%s",emailResponse->errorDetails.c_str());
         printf("\nerrorMessage:%s",emailResponse->errorMessage.c_str());
         printf("\nappErrorCode:%d",emailResponse->appErrorCode);
         printf("\nhttpErrorCode:%d",emailResponse->httpErrorCode);
         
         if(emailResponse->appErrorCode == 2303)
	     {
		   // Handle here for Not Found (Email with the id 'nick@shephertz.co.in' does not exist.)
	     }
	     else if(emailResponse->appErrorCode == 1401)
	     {
	    	// handle here for Client is not authorized
	     }
	     else if(emailResponse->appErrorCode == 1500)
	     {
		    // handle here for Internal Server Error
	     }
     }
 }
Coming Soon
Coming Soon 
Coming Soon

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.