Add an address and send the mail
Add a mail to a campaign managed via the API and send the mail.
array Envoi_Mail_API ( login, motdepasse, campagne, email, nom, prenom, p1, p2, p3, p4, p5, p6)
or, if all custom fields are needed:
array Envoi_Mail_API_v2( login, motdepasse, campagne, email, nom, prenom, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24)
Description
Authenticate on MDWorks with login and password.
Select an API-managed campaign.
Insert a row.
Send the mail.
This function lets you send mails on the fly.
Parameters (required)
login: customer ID
motdepasse: the password
campagne: campaign identifier
email: email address
nom, prenom, p1, p2, p3, p4, p5, p6: additional fields available for personalization
Return value
Returns an array containing the error message, or an integer containing the message identifier (useful for tracking).
Error messages
No field must be left empty login
No field must be left empty motdepasse
The campaign does not exist, does not belong to you, or is not managed via the API
No field must be left empty email
Authentication error (invalid login / password)
Invalid email address
Email address unsubscribed (present in your blacklist)
Insufficient credit to send this mail
Example with NuSOAP
include('nusoap/nusoap.php');
$client = new soapclient('https://www.eml-srv.com/_soap/control.php'); // Remove the 's' from 'https' if CURL is not installed
$parametres = array( 'login'=>'your_login', 'motdepasse'=>'your_password', 'campagne'=>'campaign_identifier', 'email'=>'email_address', 'nom'=>'variable_nom', 'prenom'=>'variable_prenom', 'p1'=>'variable_p1', 'p2'=>'variable_p2', 'p3'=>'variable_p3', 'p4'=>'variable_p4', 'p5'=>'variable_p5', 'p6'=>'variable_p6' );
$variable=$client->call('Envoi_Mail_API', $parametres);
// Retrieve the error, if any
if($client->fault) die("Error:Code: {$client->faultcode}
" . "Detail: {$client->faultactor}
" . "Solution: {$client->faultstring}
");
print_r($variable);Example with PHP5
try { $client = new SoapClient(null, array('location' => "https://www.eml-srv.com/_soap/control.php", 'uri' => "https://www.eml-srv.com", 'encoding'=>'ISO-8859-1' ));
$variable = $client->Envoi_Mail_API('your_login','your_password','21','test@ediware.net','Bresler','Loïc','var1','var2','var3','var4','var5','var6'); //or //$variable = $client->__soapCall(Envoi_Mail_API,$parametres);
print_r($variable); } catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}