mdEmail® Registration API

SendMessage($Message)

    $User   = array("username"=>"test1@max.md", "password"=>"123567");
    $from   = array(array("name" => "Test Test", "address" =>"test1@max.md"));
    $to     = array(array("name" => "Test1 Test1", "address" =>"test1@example.md"), array("name" => "Test2 Test2", "address" =>"test2@example.md"));
    $cc     = array(array("name" => "Test3 Test3", "address" =>"test3@example.md"), array("name" => "Test4 Test4", "address" =>"test4@example.md"));
    $Bcc    = array();

    $Message=array(
                        "MessageHead"  => array(
                            "From"  => $from,
                            "To"    => $to,
                            "Cc"    => $cc,
                            "Bcc"   => $Bcc,
                            "Subject"       => "This is a test",
                            "In-Reply-to"   => "5b9f83ad-9e83-487a-8a4b-039abdef8303@rs6.max.md", 
                            "References"    => "5b9f83ad-9e83-487a-8a4b-039abdef8303@rs6.max.md"  
                            ),
                        "MessageBody"  => array(
                            "Text"  => "I am sending emails through client API at 6:08",
                            "Attachment"    => array(
                                    0=>array(
                                        "uuid"      => "/tmp/a.txt",
                                        "filename"  => "a.txt",
                                        "mime-type" => "plain/text",
                                        "content"   => base64_encode(file_get_contents("/tmp/a.txt"))
                                        )
                                    )
                                )
                            );
            

Response

The response is a structure containing a unique message identifier that correspondes to the standard Message-ID header and an error object composed of code and message

  (string) Message-ID - a unique identifier
  (array) Error - an object with the following elements:

Sample Code (using NuSoap)(PHP)

            $soap = new SoapClient("https://api.mdemail.md/MdDirectWeb.php?wsdl", array (
                            'trace' => true,
                            'exceptions' => true,
            ));
            
            $User   = array("username"=>"test1@max.md", "password"=>"123567");
            $from   = array(array("name" => "Test Test", "address" =>"test1@max.md"));
            $to     = array(array("name" => "Test1 Test1", "address" =>"test1@example.md"), array("name" => "Test2 Test2", "address" =>"test2@example.md"));
            $cc     = array(array("name" => "Test3 Test3", "address" =>"test3@example.md"), array("name" => "Test4 Test4", "address" =>"test4@example.md"));
            $Bcc    = array();
        
            $Message=array(
                        "MessageHead"  => array(
                            "From"  => $from,
                            "To"    => $to,
                            "Cc"    => $cc,
                            "Bcc"   => $Bcc,
                            "Subject"       => "This is a test",
                            "In-Reply-to"   => "5b9f83ad-9e83-487a-8a4b-039abdef8303@rs6.max.md", 
                            "References"    => "5b9f83ad-9e83-487a-8a4b-039abdef8303@rs6.max.md"  
                            ),
                        "MessageBody"  => array(
                            "Text"  => "I am sending emails through client API at 6:08",
                            "Attachment"    => array(
                                    0=>array(
                                        "uuid"      => "/tmp/a.txt",
                                        "filename"  => "a.txt",
                                        "mime-type" => "plain/text",
                                        "content"   => base64_encode(file_get_contents("/tmp/a.txt"))
                                        )
                                    )
                                )
                            );
            
            $sendResponse   = $soap->SendMessage($User, $Message);
            
            SendResponse {
            	Message-ID: 00cc01cc1c6e$8821f990$9865ecb0$@md
                Result {
                	code: delivered
                    message: The message has been delivered to the endpoint addresses of all recipients
                }   
                
            }
            
            

The xml for the WSDL can be found here