×

info

Dear guests,
You are currently on the old forum we kept as a knowledge base. You will find the new community forum here
Welcome, Guest
Username: Password: Remember me
Keyword

TOPIC: Send a Newsletter to a single user (PHP script)

Send a Newsletter to a single user (PHP script) 4 years 6 months ago #94763

  • Anonymous user
  • miracle's Avatar
  • Posts: 42
  • Karma: 1
Hi,

I'm testing with sending a newsletter to a single user through a PHP script. I looked at www.acyba.com/acymailing/64-acymailing-d...html#sendsingleemail and used that code, after I looked at www.acyba.com/acymailing/64-acymailing-d...ation.html#joomlaapi and also inserted that code. The result is below.

I get mail, but not all parameters are used. Only 'voornaam' (first name) is used. I tried to put the parameter 'weekdag' (day of the week) first to see if it would only use the first parameter listed, but even then it only uses 'voornaam'. I tried adding 'weekdag' in Acymailing to the Custom fields, but that didn't solve the problem.

That gives me a few questions:

1. What is wrong in my code?
2. I don't use the Joomla API now. Is that smart? Why should I change that and how?
<?php

define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
 
if (file_exists(dirname(__FILE__) . '/defines.php')) {
 include_once dirname(__FILE__) . '/defines.php';
}
 
if (!defined('_JDEFINES')) {
 define('JPATH_BASE', dirname(__FILE__));
 require_once JPATH_BASE.'/includes/defines.php';
}
 
require_once JPATH_BASE.'/includes/framework.php';
$app = JFactory::getApplication('site');


if(!include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php')){
 echo 'This code can not work without the AcyMailing Component';
 return false;
 }
$mailer = acymailing_get('helper.mailer');
$mailer->report = true;
$mailer->trackEmail = true;
$mailer->autoAddUser = false;
$mailer->addParam('weekdag','woensdag');
$mailer->addParam('voornaam','Stephan');
$mailer->addParam('datum','10 februari');
$mailer->addParam('starttijd','20:30');
$mailer->sendOne(42,'stephan@myurl.nl');

?>
Please log in to post a reply

Send a Newsletter to a single user (PHP script) 4 years 6 months ago #94766

  • Dax
  • Dax's Avatar
  • Posts: 6423
  • Karma: 227
Hello,

Your code seems to be good, if you add "{weekdag}" in the newsletter n°42 it should be replaced by "woensdag".
Note that the tags you insert in the newsletter with the tags popup will also be replaced if the Acy user "This email address is being protected from spambots. You need JavaScript enabled to view it." already exists.
-AcyMailing developer-
This email address is being protected from spambots. You need JavaScript enabled to view it.

I helped you? The best way to thank me is to post a review on the JED :laugh:

Do not hesitate to illustrate your messages with screenshots, I love images :)
Always consult our tutorials before asking a question on our forum, the answer is surely there ;)

Hey look at our Video tutorials, It's really helpful to understand how Acy works!
Please log in to post a reply

Send a Newsletter to a single user (PHP script) 4 years 6 months ago #94777

  • Anonymous user
  • miracle's Avatar
  • Posts: 42
  • Karma: 1
I didn't read the instruction good enough, so I ended up using {subtag:var1} instead of {var1} in my mails. Strangely enough that didn't gave a problem with field 'voornaam', but that's probably because I use that variable more ofter and made it a Custom field earlier on.

Problem solved, thank you!
Last Edit: 4 years 6 months ago by Anonymous user.
Please log in to post a reply

Send a Newsletter to a single user (PHP script) 3 years 8 months ago #105536

  • Anonymous user
  • Afrikao's Avatar
  • Posts: 5
  • Karma: 0
Hello Dax,
could you hint how to run this script ?
Because a direct link with Joomla site like
/joomlawebsite/api.php
(where api.php contains the code above)
does not work.
Thanks in advance !
P.S. We still can't find a right way under
www.acyba.com/forum/5-acymailing-how-to/...php-api-scripts.html
Last Edit: 3 years 8 months ago by Anonymous user.
Please log in to post a reply
Time to create page: 0.065 seconds
Powered by Kunena Forum