SMS
     
API CENTRAL
        
 
List of our API's:
 
File API
With this API you can Upload Files to theMailMonster.com File Repository from your own Application. Create smart applications using our File API. From your own application you can communicate with our File Servers to store and retrieve files.
Mail API
With this API you can Send Letters from your own application. Save time and money by outsourcing the printing and delivery of your letters to us.
SMS API
With this API you can Send SMS's from your own application. Increase communication with your customers by using our SMS API.
 
Instructions
To use theMailMonster.com API's you will need to register. Once registered, click on the Account Folder and Generate a Key.

All of the API's require your User Id, Email, Key.
 
Support
Contact us or email support@themailmonster.com
  
 
Info
 
Use this API to Upload Files and Get Files from theMailMonster.com File Repository.
 
Technical Details
• You will need the TmmAPI.dll for a .NET (C#) or TmmAPI.jar for Java.
• Depending on the server load, requests may take up to 5 seconds.
 
Limitations
• Maximum file size for upload and retrieval is 1MB.
• Valid Mime Types for the UploadFile() Method are:
  
 
Cost
• Free.
 
Download
 
For C# - Download Zip File containing TmmAPI.dll
 
For Java - Download Zip File containing TmmAPI.jar
 
Include TmmAPI
 
using TmmAPI; // For C#
import TmmAPI.*; //For Java
 
Method: UploadFile()
 
TmmFileAPI ObjTmmFileAPI = new TmmFileAPI();
ObjTmmFileAPI.ConnectWithPassword("john@sample.com","my_password");

byte[] BinaryData = ObjTmmFileAPI.FileToByteArray("MyLocalFile.pdf");

ObjTmmFileAPI.UploadFile("pdfs","NewFile.pdf","application/pdf",BinaryData);

if(ObjTmmFileAPI.HasError())
    Console.WriteLine(ObjTmmFileAPI.GetError()); // Print Error
else    
    String XmlResult = ObjTmmFileAPI.GetXmlResult(); // Success...    
 
Method: GetFileList()
 
TmmFileAPI ObjTmmFileAPI = new TmmFileAPI();                
ObjTmmFileAPI.ConnectWithPassword("john@sample.com","my_password");

ObjTmmFileAPI.GetFileList("home"); 

if(ObjTmmFileAPI.HasError())
   Console.WriteLine(ObjTmmFileAPI.GetError());// Print Error
else
    String XmlResult = ObjTmmFileAPI.GetXmlResult(); // Success...    
 
Method: GetFile()
 
TmmFileAPI ObjTmmFileAPI = new TmmFileAPI();                
ObjTmmFileAPI.ConnectWithPassword("john@sample.com","my_password");

byte[] BinaryData = ObjTmmFileAPI.GetFile("9876543432");

if(ObjTmmFileAPI.HasError())
    Console.WriteLine(ObjTmmFileAPI.GetError()); // Print Error
else
    String XmlResult = ObjTmmFileAPI.GetXmlResult(); // Success...  
 
Error Messages
<document>
    <info>

        <!-- Common  Errors -->
        <error>Invalid User Id, Email and Key combination.</error>
        <error>Invalid Folder.</error>
        <error>Could not connect to server. Try again.</error>
        <error>You have not yet connected. Please use the Connect() or SecureConnect() Method.</error>
        <error>Max Upload Size Exceeded.</error>
        <error>Please generate a key.</error>
        <error>An unknown error has occurred.</error>

        <!-- UploadFile() Errors -->
        <error>File Name Missing.</error>
        <error>File Name is blank.</error>
        <error>File Type (Mime Type) Missing.</error>
        <error>Invalid File Type (Mime Type).</error>
        <error>File is greater than 1MB (1024000 bytes).</error>
        <error>Upload file error. Could not upload the file. [ err ].</error>
        <error>Unable to decode base64 data.</error>

        <!-- GetFileList() Errors -->
        <error>No Files Found.</error>

        <!-- GetFile() Errors -->
        <error>No Files Found.</error>
        <error>Get file error. Could not get the file.</error>
        <error>Unable to decode base64 data.</error>

    </info>
</document>
 
UploadFile() XML Result
<document>
    <info><uploadFileId>9876543432</uploadFileId></info>
</document>
 
GetFileList() XML Result
<document>
   <sysFolders>
      <folder><name>home</name></folder>
      <folder><name>images</name></folder>
      <folder><name>pdfs</name></folder>
      <folder><name>sms</name></folder>
   </sysFolders>
   <userFolders>
      <folder><name>My Folder 1</name></folder>
      <folder><name>My Folder 2</name></folder>
   </userFolders>
   <info>
      <fileCount>2</fileCount>
      <checkForMoreRecords>N</checkForMoreRecords>
   </info>
   <files>
      <file>          
          <id>53453421</id>
          <date>20110203 16:45:43.3</date>
          <name>My PDF File</name>
          <size>53256</size>
          <type>application/pdf</type>
          <publicFileId/>
          <blobKey/>
          <ipAddress>123.123.123.1</ipAddress>
      </file>
      <file>          
          <id>6262365</id>
          <date>20110204 16:45:43.3</date>
          <name>My Text File</name>
          <size>5323</size>
          <type>text/plain</type>
          <publicFileId/>
          <blobKey/>
          <ipAddress>123.123.123.1</ipAddress>
      </file>
   </files>
</document>
 
GetFile() XML Result
<document>
   <info>
      <fileCount>1</fileCount>
   </info>
   <files>
      <file>          
          <id>53453421</id>
          <date>20110203 16:45:43.3</date>
          <name>My PDF File</name>
          <size>53256</size>
          <type>application/pdf</type>            
          <base64Data>k5OT5dCi9Sb290IDUgMCBSCj4+C
          nN0YIDkgMCBSCi9JbmZvXJ0eHJlZgoxMDE
          xCiUlRU9GCg==(and so on...)
          </base64Data>
      </file>
   </files>
</document>
  
 
Info
 
Use this API to Send Letters from your application/website.
 
Technical Details
• You will need the TmmAPI.dll for a .NET (C#) or TmmAPI.jar for Java.
• Depending on the server load, requests may take up to 5 seconds.
 
PDF Specifications
• Include a Blank Page as the 1st Page of the PDF - OR - Keep the Address Block Area clear.
• Paper Size is LETTER, size 8.5" x 11".
• Envelope is Business envelope #10 double window, size: 4 1/8" x 9 1/2".
 
IMPORTANT - Before you go Live (Production Mode)
• Ensure you call the Testing() Method. e.g. ObjTmmMailItem.Testing()
• If your letter is successfully sent:
 
    1. Xml Result will contain the "<result>" node insted of "<error>" node.
    2. Details of the Recipient will be stored your PDF's Folder. e.g. TMM-letter-api-1234-cl.xml
    3. A copy of the PDF File will be stored in your PDF's Folder. e.g. TMM-letter-api-1234-cl.pdf
 
Contact us to confirm your mail item has been processed. That's it! You can now go to Production Mode.
 
Limitations
• Maximum file size for SetPDFData() Method is 1MB.
• Valid Mime Type for the SetPDFData() Method is application/pdf.
Cost
• $0.95 (USD) per letter - United States
• $2.10 (USD) per letter - Other Countries
• Add $0.35 for additional pages.
 
Download
 
For C# - Download Zip File containing TmmAPI.dll
 
For Java - Download Zip File containing TmmAPI.jar
 
Include TmmAPI
 
using TmmAPI; // For C#
import TmmAPI.*; //For Java
 
Sample Code
 
 
TmmMailItem ObjTmmMailItem = new TmmMailItem();
ObjTmmMailItem.ConnectWithPassword("john@sample.com","my_password");

ObjTmmMailItem.SetName("John Sample");
ObjTmmMailItem.SetAddressLine1("1 Sample Street");
ObjTmmMailItem.SetAddressLine2("");
ObjTmmMailItem.SetTownCity("LOS ANGELES");
ObjTmmMailItem.SetState("CA");
ObjTmmMailItem.SetZipPostcode("90200");
ObjTmmMailItem.SetCountry("United States");

ObjTmmMailItem.Testing(); // Set this for testing mode. You will not be charged.

byte[] BinaryData = ObjTmmMailItem.FileToByteArray("MyLocalLetter.pdf");

ObjTmmMailItem.SetPDFData(BinaryData);

ObjTmmMailItem.Send();

if(ObjTmmMailItem.HasError())
   Console.WriteLine(ObjTmmMailItem.GetError());
else
{ 
   XmlResult = ObjTmmMailItem.GetXmlResult(); 
   Console.WriteLine(XmlResult);
}
 
Error Messages
<document>
    <info>

        <!-- Common  Errors -->
        <error>Invalid User Id, Email and Key combination.</error>
        <error>Invalid Folder.</error>
        <error>Could not connect to server. Try again.</error>
        <error>You have not yet connected. Please use the Connect() or SecureConnect() Method.</error>
        <error>Max Upload Size Exceeded.</error>
        <error>Please generate a key.</error>
        <error>An unknown error has occurred.</error>

        <!-- Send Mail Item Errors -->
        <error>Please add credit to your account.</error>
        <error>Could not calculate number of pages.</error>
        <error>File is greater than 1MB (1024000 bytes).</error>
        <error>Web Service Error.</error>
        <error>You do not have enough credit. It will cost $X.xx to send this mail item.</error>
        <error>Mandatory Field Missing.</error>

    </info>
</document>
 
Mail Item Successfully Sent
<document>
   <info><result>Mail Item Successfully Sent. [ File Id: 123456789 ]</result></info>
</document>
           
 
Info
 
Use this API to Send SMS's form your application/website.
 
Technical Details
• Available in C#, Java, PHP and JavaScript.
• Click on "App Id's" to get the SmsAppId.
 
Cost
• $0.12 (USD) per sms
using System;
using System.Net;
using System.IO;
using System.Text;

class TmmSms
{
    static void Main(string[] args)
    {
     
        // Set variables below...           

        string UserId    = "1234567";
        string UserKey   = "wS5KVmu3dvhFNeocVZsM";
        
        string SmsAppId  = "3269787";
        string SmsTelNo  = "61412345678";
        string SmsMsg    = "This is a test message from a C App";        
        
        string UrlString = "http://www.themailmonster.com/s_m_s.jsp?UserId=" + UserId +
        "&UserKey="  + UserKey  +
        "&SmsAppId=" + SmsAppId +
        "&SmsTelNo=" + SmsTelNo +
        "&SmsMsg="   + SmsMsg   +
        "&SMSFunction=SMSAPI";
        
        StringBuilder sb        = new StringBuilder();
        byte[] buf              = new byte[8192];
        HttpWebRequest request  = (HttpWebRequest)
        
        WebRequest.Create(UrlString);
        
        HttpWebResponse response = (HttpWebResponse)
        request.GetResponse();
        
        Stream resStream  = response.GetResponseStream();
        
        string tempString = null;
        int    count      = 0;
        
        do
        {
            count = resStream.Read(buf, 0, buf.Length);
            if (count != 0)
            {
                tempString = Encoding.ASCII.GetString(buf, 0, count);
                sb.Append(tempString);
            }
        }
        while (count > 0);
        
        Console.WriteLine(sb.ToString());        
    }
    
}   
import java.net.*;
import java.io.*;

public class TmmSms
{
    public static void main(String[] args) throws Exception
    {                

        // Set variables below...

        String UserId    = "1234567";
        String UserKey   = "wS5KVmu3dvhFNeocVZsM";
        
        String SmsAppId  = "3269787";
        String SmsTelNo  = "61412345678";
        String SmsMsg    = "This is a test message from a Java App";
        
        SmsMsg           = URLEncoder.encode(SmsMsg,"UTF-8");        
        
        String UrlString = "http://www.themailmonster.com/s_m_s.jsp?UserId=" + UserId +
        "&UserKey="  + UserKey  +
        "&SmsAppId=" + SmsAppId +
        "&SmsTelNo=" + SmsTelNo +
        "&SmsMsg="   + SmsMsg   +
        "&SMSFunction=SMSAPI";
        
        URL URLSms            = new URL(UrlString);
        URLConnection SmsConn = URLSms.openConnection();
        BufferedReader in = new BufferedReader(new InputStreamReader(SmsConn.getInputStream()));
        String inputLine;
        
        while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);
        in.close();
        
    }
}
    //Set variables below...

    $UserId      = "1234567";
    $UserKey     = "wS5KVmu3dvhFNeocVZsM";
    
    $SmsAppId    = "3269787";
    $SmsTelNo    = "61412345678";
    $SmsMsg      = "This is a test message from a PHP App";
    
    $SmsMsg      = urlencode($SmsMsg);

    $UrlString   = "?UserId="   . $UserId   .
    "&UserKey="  . $UserKey  .
    "&SmsAppId=" . $SmsAppId .
    "&SmsTelNo=" . $SmsTelNo .
    "&SmsMsg="   . $SmsMsg   .
    "&SMSFunction=SMSAPI";
    
    $CompleteUrl = 'http://www.themailmonster.com/s_m_s.jsp' . $UrlString;
    
    $ch=curl_init();
    curl_setopt($ch,CURLOPT_URL,$CompleteUrl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $data = curl_exec($ch);
    curl_close($ch);
    
    print($data);
   

Contact us to get the country code list.
 
 
FAQ  |  Privacy  |  Terms and Conditions  |  Contact us
All rights reserved.
   
  SSL Certificates