Showing posts with label source code. Show all posts
Showing posts with label source code. Show all posts

Monday, March 03, 2014

It's a bird…It's a plane…It's v4!

By: Melonie Mottice
Marketing Specialist





The latest and greatest editor is live!

Like last month, we've been very busy at JangoMail. What a better way to kick off March than with a new editor?!? Our new v4 HTML Editor is our most advanced editor and is available now. It has a brand new look to match our UI, and all the same great features that EditLive has, along with a few extras. NOTE:  Any locked content you created in the other editors will still work.

Here are a few New Features:

  1. Image Capabilities – Upload your images and graphics directly in the editor, no need to upload separately in Assets.
  2. Source Code Button – This replaces the old HTML button.  Click to edit your HTML.
  3. Template Button – Choose a Smart Template directly from the editor.
  4. Spell Check Button – Double check the spelling of your copy.
  5. Block Quote – Adds a block quote, or indented quotation.
  6. Insert Content Button – CAN SPAM Footer and Social share, Unsubscribe, Forward-a-friend, and View-as-web-page links are found here.
  7. QR Code Picture Generator – Easily insert a QR code here. Great for any promotions, contests or giveaways.
  8. Maximize Button – This replaces the Toggle Full Screen button. The function is the same but the look is new. Use it to open a new window to work with a larger screen.











To see how these and all the other v4 features work, check out our updated documentation.


Monday, March 19, 2012

Calling the JangoMail Web Service in Python

Python is a language that seems to make so many mundane programming tasks easy. Unfortunately, some python libraries are perhaps less fully developed than the libraries of other languages. This is certainly the case of the python soap libraries SOAPpy and SUDS. In my experience, both libraries are painfully buggy. In python, I think it's easier just to use httplib and build the xml manually. Luckily, python's other conveniences make that pretty easy!

In this example, we build an xml template for calling Groups_GetList_String. To test it with your own account, just insert your own JangoMail/JangoSMTP credentials. Download the source code for this example to start your own integration!


import sys
import httplib

# setup the sml template xml for a call to Groups_GetList_String
SM_TEMPLATE = """<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Groups_GetList_String xmlns="http://api.jangomail.com/">
      <Username>%s</Username>
      <Password>%s</Password>
      <RowDelimiter>%s</RowDelimiter>
      <ColDelimiter>%s</ColDelimiter>
      <TextQualifier>%s</TextQualifier>
    </Groups_GetList_String>
  </soap12:Body>
</soap12:Envelope>
"""

# fill in the parameters for our call
SoapMessage = SM_TEMPLATE%("Your JangoMail/JangoSMTP Username", 
              "Your Password", "\n", " - ", "")

# examine the soap message that we have constructed
print SoapMessage

# insert the proper values into the header
webservice = httplib.HTTP("api.jangomail.com")
webservice.putrequest("POST", "/api.asmx")
webservice.putheader("Host", "api.jangomail.com")
webservice.putheader("User-Agent", "Python post")
webservice.putheader("Content-type", 
    "application/soap+xml; charset=\"UTF-8\"")
webservice.putheader("Content-length", "%d" % len(SoapMessage))
webservice.putheader("SOAPAction", 
    "http://api.jangomail.com/Groups_GetList_String")
webservice.endheaders()
webservice.send(SoapMessage)

# get the response and print it
statuscode, statusmessage, header = webservice.getreply()
print "Response: ", statuscode, statusmessage
print "headers: ", header
res = webservice.getfile().read()
print res

Monday, February 27, 2012

Integrating the JangoMail API Into a Java Application

If you want to integrate JangoMail's web service into your company's existing Java software, this example will show you how to hit the ground running. This example relies on Java's built-in library for processing soap requests javax.xml.soap. Download the source code for this example here.

In the first part of this example, the SOAPMessage is created. In this case, we will call the Groups_GetList_String method, which will return a list of groups on your account. Make sure to set the SOAPAction header to indicate which method you want to call.

// create the connection
SOAPConnectionFactory soapConnFactory 
    = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnFactory.createConnection();

//Next, create the actual message/request
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
          
//Create objects for the request parts            
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
  
// set the SOAPAction Header to the desired request
MimeHeaders headers = message.getMimeHeaders();
headers.addHeader("SOAPAction", 
    "http://api.jangomail.com/Groups_GetList_String");
Next, the message is populated with our parameters and sent to the JangoMail servers.
// Populate the body of the request
// create the main element and namespace
SOAPElement bodyElement = body.addChildElement(
        envelope.createName("Groups_GetList_String", 
                            "", 
                            "http://api.jangomail.com/"));
   
// add the parameters
bodyElement.addChildElement("Username")
    .addTextNode("Your JangoMail/JangoSMTP Username");
bodyElement.addChildElement("Password")
    .addTextNode("Your JangoMail/JangoSMTP Password");
bodyElement.addChildElement("RowDelimiter").addTextNode("\n");
bodyElement.addChildElement("ColDelimiter").addTextNode(" - ");
bodyElement.addChildElement("TextQualifier").addTextNode("");
   
// save the message
message.saveChanges();
   
// Send the message and print the reply
// set the destination
String destination = "http://api.jangomail.com/api.asmx";
// send the message
SOAPMessage reply = connection.call(message, destination);
Finally, the response is received and printed.
//Check the output
System.out.println("\nRESPONSE:\n");

//Create the transformer
TransformerFactory transformerFactory 
    = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();

//Extract the content of the reply
Source sourceContent = reply.getSOAPPart().getContent();

//Set the output for the transformation
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);
System.out.println();
Make sure to Download the complete source code for this example and populate it with the values from your JangoMail or JangoSMTP account.

Monday, February 20, 2012

Using the JangoMail API in PHP

Since PHP 5 provided developers with the SoapClient class, it's a snap to consume SOAP-enabled web services in a PHP script.

This example demonstrates how to connect to the JangoMail API in order to get the email lists on your account. Download the source code for this example, insert your own JangoMail credentials, and you're ready to start integrating the JangoMail API with your php website.

// create a SoapClient object for the jangomail aPI
$client = 
    new SoapClient("http://api.jangomail.com/api.asmx?WSDL");

// set the parameter array for the
// Groups_GetList_String method
$param=array(
 'Username'=>'Your JangoMail Username',
 'Password'=>'Your JangoMail Password',
 'RowDelimiter'=>'<br/>',
 'ColDelimiter'=>' - ',
 'TextQualifier'=>''
); 

// using the JangoMail API
// call the Groups_GetList_String method
$result = $client->Groups_GetList_String($param);

// print the groups that were returned
print($result->Groups_GetList_StringResult);