Page tree
Skip to end of metadata
Go to start of metadata


Allows the creation of an email message within the desired list.

Method parameters

  • string CreateNewsletter(string accessKey, int listID, string subject, string type, string content, Option[] options)
    • accessKey: access key obtained using the LoginFromId method
    • listID: ID of the list within which the newsletter has to be created. Lists and corresponding IDs can be obtained calling the GetLists Method
    • subject: subject of the email message
    • type: type of message text (HTML, URL, FILE, TEXT)
    • content: message text source, depending on the type:
      • type = HTML, content is the HTML code of the message
      • type = TEXT, content is the PLAIN-TEXT of the message (this value is deprecated and it is handled exactly as "HTML")
      • type = URL, content is the url from which to draw the HTML code of the message
      • type = FILE, content is a byte array from which to draw the HTML code of the message
    • options: an array of key/value pairs for options setting
      • note: a string containing notes about the message
      • dyn_fld: boolean value to enable/disable the use of dynamic fields in the message (dyn_fld=true, dyn_fld=false)
      • emb_img: boolean value to enable/disable the use of embedded images in the message (emb_img=true, emd_img=false)
      • link_track: boolean value to enable/disable the use of link tracking in the message (link_trcak=true, link_track=false). If link_track=true and no other option is specified all the protocols are activated.
      • track_http: boolean value to enable/disable the use of http protocol tracking in the message (track_http=true, track_http=false)
      • track_https: boolean value to enable/disable the use of HTTPS protocol tracking in the message (track_https=true, track_https=false)
      • track_mailto: boolean value to enable/disable the use of MAILTO protocol tracking in the message (track_mailto=true, track_mailto=false)
      • track_ftp: boolean value to enable/disable the use of FTP protocol tracking in the message (track_ftp=true, track_ftp=false)
      • track_news: boolean value to enable/disable the use of NEWS protocol tracking in the message (track_news=true, track_news=false)
      • link_params: a string allowing to specify additional parameters for tracked links
      • body_code: a string containing a personalized code for the <body> tag
      • header: a string containing a personalized code for the <header> tag
      • conf_msg: boolean value to mark the message used as a subscription confirmation
      • attach<nn>_data = base64 file encoding
      • attach<nn>_name = filename
      • template = ID of the template to be used for newsletter creation. In case the "template" parameter is specified, "body_code" and "content" parameters will be ignored.

If error code=0, the message will contain the ID of the newsletter which has been created

SOAP Examples

SOAP Request
<soap:Envelope xmlns:soap="" xmlns:ws="">
          <!-- use campoNN (where NN goes from 1 to 39) and set dyn_fld=true to insert dynamic fields in the subject -->
          <ws:subject>This is a new html newsletter for [campo1]</ws:subject>
          <!-- use campoNN (where NN goes from 1 to 39) and set dyn_fld=true to insert dynamic fields inside message body -->
          <ws:content>hello [campo1] [campo2]&lt;/br >&lt;/br > lorem ipsum dolor sit amet, consectetur adipiscing elit. </ws:content>
             <ws:Option><ws:Key>note</ws:Key><ws:Value>testing html message</ws:Value></ws:Option>

             <!--you can add one or more attachments: do not specify "CDATA" for encoded data-->
             <ws:Option><ws:Key>attach01_data</ws:Key><ws:Value>llPxu+vqfw/+R/As7 ... kVRRmrwTMgAAAABJRU5ErkJggg==</ws:Value></ws:Option>
SOAP Response

Code Examples

# Refer to for gem information.
require 'mailup'
m ='username', 'password')
m.get_create_newsletter(:listId => 1, :subject => "Sample Subject", :type => 'HTML', :content => "HTML Content...", "Options" => {...})
# => <CreateNewsletterResult><errorCode>0</errorCode><errorDescription></errorDescription><listID>1</listID><newsletterID>3</newsletterID></CreateNewsletterResult>"
class MailUpWsSend {

protected $WSDLUrl = "";
private $soapClient;
private $xmlResponse;
protected $domResult;

function __construct() {
	$this->soapClient = new SoapClient($this->WSDLUrl,
	array("trace" => 1,
	"exceptions" => 0));

function __destruct() {

public function loginFromId($loginData) {
	try {
		if ($this->readReturnCode("LoginFromId","errorCode") != 0) {
			echo "<br /><br />LoginFromId Error: ". $this->readReturnCode("LoginFromId","errorDescription");
	else $this->accessKey = $this->readReturnCode("LoginFromId","accessKey");
	} catch (SoapFault $soapFault) { 

public function createNewsletter($params) {
	try {
		$params = array_merge((array)$params, array("accessKey" => $this->accessKey));
		if ($this->readReturnCode("CreateNewsletter","errorCode") != 0) 
			echo "<br /><br />CreateNewsletter Error: ". $this->readReturnCode("CreateNewsletter","errorCode") ." - " . $this->readReturnCode("CreateNewsletter","errorDescription");
	} catch (SoapFault $soapFault) { 

private function readReturnCode($func, $param) {
	$this->xmlResponse = $this->soapClient->__getLastResponse();
	$dom = new DomDocument();
	$dom->loadXML($this->xmlResponse) or die("File XML non valido!");
	$xmlResult = $dom->getElementsByTagName($func."Result");
	$this->domResult = new DomDocument();
	$this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die("File XML1 non valido!");;
	$rCode = $this->domResult->getElementsByTagName($param);
	return $rCode->item(0)->nodeValue;

public function option($key, $value) {
	return array("Key" => $key, "Value" => $value);


// for more info about login process please refer to
$loginData = array("user" => "YOUR_CONSOLE_USERNAME","pwd" => "YOUR_CONSOLE_PASSWORD","consoleId" => "YOUR_CONSOLE_ID");
$WsSend = new MailUpWsSend();
$newsLetterData = array("listID" => "1",
            "subject" => "this is my subject",
            "type" => "HTML",
            "content" => "Hello world, this is message body",
            "options" => array($WsSend->option("note","additional notes"),
                $WsSend->option("dyn_fld", true),
                $WsSend->option("link_track", true),
                //... other options


If you're using a language that is based on .Net framework please check this page 

  • No labels


  1. Anonymous

    what are the default values of the "options" parameter?

    for example, dyn_fld is by default false or true?

  2. These are the default values for boolean types
    • dyn_fld = false
    • emb_img = false
    • link_track = true
    • track_http = true
    • track_https = true
    • track_mailto = true
    • track_ftp = true
    • track_news = true
    • conf_msg = false

    Default value for string types is an empty string.

  3. Anonymous

    Why i get this error

    Fatal error: SOAP-ERROR: Encoding: object has no 'listID' property in /my/path/lib/mailUpWsSend.php on line 72

    when i call this function?

    	1, // This should be listID
    	"HTML Content..."
  4. Hi, please have a look at PHP example that we have just provided. If you're experiencing other problems please contact MailUp support team. Regards

  5. Anonymous

    Consider my situation,

    lets create a template into the mailup console. 


    Test Email Template,

    Hi [firstname],

    This is the text message. [needsTobeReplaced] !!! 




    now how could I replace this dynamic content [needsTobeReplaced] ??? 

    1. Hi, the answer depends on what you mean with "needs to be replaced"

      1. If you mean a content that is specific for each recipient you should reserve a personal data field ("campo dinamico") and update all your recipients with the proper value using MailUpImport methods. Then you'll be able to insert the corresponding personal data field placeholder inside the message body, as you are already doing with [lastname]
      2. If you mean using always the same email template and replace only a part depending on filters that apply to recipients' personal data you can do it in this way
        1. you can define a dynamic content ("contenuto dinamico") on MailUp console application and reference it in your message (e.g. "Hi [firstname], This is the text message.[*Cnt_11_dynamicexample*] !!! ...")
        2. dynamic content may consist of html body of another MailUp message, that replaces the placeholder when a specific filter is matched (see dynamic content and their filters in MailUp documentation)
      3. As an alternative approach, that fits only when the text to be replaced applies to all recipients, you can 
        1. save your template as a standard message, 
        2. call GetNewsletterCode to retreive template source code and replace [needsTobeReplaced] inside your application. 
        3. call CreateNewsletter passing the final code 

      Please note that you need Marketing+ option enabled to take advantage of dynamic content features

      Hope this helps,

      Best regards