Browse Source

new example

master
4026 2 years ago
parent
commit
4cedaa54f0
1 changed files with 16 additions and 15 deletions
  1. +16
    -15
      example.simple.php

+ 16
- 15
example.simple.php View File

@ -1,21 +1,22 @@
<?php
$post = [
'list' => 23,
'name' => 'Subscriber John',
'email' => '[email protected]',
'activated' => 1
];
include "ninjamail.class.php";
$ch = curl_init('http://hirlevel.sandros.eu/a/subscribe?key=f953d4b526fdffda0d58bcd39fbbab29800f31ec8c6bcff53af359cd6528337e5bda05f3faf3f2beef4fb1cc8eeee906be67d6bc7c4b04af61dfc239d6b079e1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
// Mail
$mail = new ninjaMailSend('https://admin.dimail.hu', 'API_KEY');
$mail->to('[email protected]');
$mail->subject('Hello');
$mail->message('HTML_CONTENT', 'TEXT_CONTENT');
var_dump($mail->send());
// execute!
$response = curl_exec($ch);
// Newsletter
$newsletter = new ninjaMailNewsletter('https://admin.dimail.hu', 'API_KEY');
$newsletter->subject('New subject');
$newsletter->message('HTML_CONTENT', 'TEXT_CONTENT OR NULL');
// close the connection
curl_close($ch);
if ($newsletter->update() && $newsletter->send())
echo "updated & sent\n";
// lets see
var_dump($response);
// Stats
$stat = new ninjaMailStatistics('https://admin.dimail.hu', 'API_KEY');
print_r($stat->get(3512201));

Loading…
Cancel
Save