Follow

How to program the MDirector Transactional Email Service via SMTP

María Rico

To begin, ask your MDirector sales or support agent to activate the service in your account.

In parallel you can perform the following actions:

  1. Set up a domain or subdomain following the instructions of MDirector.


  2. Send us this information:
    1. The name of the configured domain or subdomain.
    2. The IP(s) from which you are going to send emails to MDirector
    3. The type of emails you are going to send
    4. Expected daily or weekly volume.
    5. Approximate distribution in domains (percentage of hotmail, yahoo, gmail, and other service providers that may have a considerable percentage of users in your database).

 

MDirector will provide you with the SMTP address through which you must send the communications to go out through the SMTP channel (user and password credentials).

Once the account has been configured by MDirector, finish programming your mailings from your server:

  1. Check the connection between your server and MDirector's host with the command:
    telnet smtptrans.mdirector.com 25

    The result which should return if it is working correctly is the following:
    Trying 62.97.140.41...
    Connected to smtptrans.mdirector.com.
    Escape character is '^]'.
    220 smtptrans01 ESMTP Exim 4.80 Wed, 13 Jan 2016 16:26:00 +0100

    In case you do not receive a connection response, you can try connecting to port 587 which is also open:

    telnet smtptrans.mdirector.com 587

  2. Program the connection between the client system and MDirector-trans that is made using an SMTP library, with private credentials.


  3. Program the sending system also using the SMTP library, with which you can configure each part of the sending, including the header where the tags are added, which MDirector then takes into account to identify and filter the sending in the statistics. The nomenclature of these tags always begins with X-MDTrans and is as follows:

If you want to send with templates, you have to use the additional header name: "X-MDTrans-TemplateId" to include the id (value) of the template you are going to use and if you want to replace variables inside the template: name: "X-MDTrans-TemplateVars". This header is an object (value) formed by the name of the variable and the value to replace.

If you want to track clicks on the links in the email content, you have to use the additional header name: "X-MDTrans-Tracklinks" with the value 1.

To add tags to the transactional email, you can add multiple tags separated by "," using the parameter: "X-MDTrans-Tags".


For example:

use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mail\Transport\SmtpOptions;

$headers = new \Zend\Mail\Headers();
$headers->addHeaderLine('X-MDTrans-Tags', 'tag1,tag2,tag3');

 

$message = new Message();
$message->setHeaders($headers)
        ->addTo('todomain@todomain.com')
        ->addFrom('from@domainfrom.com')
        ->setSubject('Greetings and Salutations!')
        ->setBody("Sorry, I'm going to be late today!");

// Setup SMTP transport using LOGIN authentication
$transport = new SmtpTransport();
$options   = new SmtpOptions(array(
    'name'              => 'smtptrans.mdirector.com',
    'host'              => 'smtptrans.mdirector.com',
    'connection_class'  => 'crammd5',
    'connection_config' => array(
        'username' => 'user',
        'password' => 'pass'
    ),
));
//$options->setPort(587);
$transport->setOptions($options);
$transport->send($message);

 

 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk