Search

I need to send an email once per week to a list of email addresses stored in a Symphony section (its not about Viagra). The email will need to be sent via a Gmail SMTP account (which Symphony already uses).

Knowing no other way, I am considering an ex-Symphony cron-triggered PHP/PEAR solution. I'm sure Symphony and ETM could do this but don't know how. Has anyone down this or can anyone suggest a solution.

Thanks

This is perfectly possible, because the ENM has an API which you can use. You might create a Symphony page and attach a custom event to it. Think of this page as a private API endpoint which can later be called by Cron.

  • Protect your API (i.e. the page) output with an access token in a get GET parameter and some XSLT logic; use SSL (so nobody can ever see the access token).
  • Use the same access token in your custom event. The event should only trigger if the $_GET parameter value is correct.
  • Now in your custom event, talk to the ENM's API.

I am afraid that there is no API documentation, but you can take a look at the source to find the possibilities. Basically you can do things like:

$newsletter = EmailNewsletterManager::create($newsletter_id);
$newsletter->start();
$newsletter->pause();
$newsletter->stop();

You can also save a newsletter:

EmailNewsletterManager::save(array(
    'template'   => is_object($newsletter->getTemplate()) ? $newsletter->getTemplate()->getHandle() : NULL,
    'sender'     => is_object($newsletter->getSender()) ? $newsletter->getSender()->getHandle() : NULL,
    'recipients' => implode(', ', $newsletter->getRecipientGroups(false, true)),
    'started_by' => $author_id,
    'pseudo_root' => 'http://' . $this->_client_domain,
));

(The above example could be used to restart a newsletter, i.e. create a new one.)

(If you pass the ID as well, you will manipulate an existing one.)

I don't know where your content will come from, so I can't give you a more detailed advice.

Thanks Michael this is a great start. Will investigate

Keep in mind that a "newsletter" is just a special entry in the email_newsletters table in the DB. Each row contains the information necessary to send a newsletter. A newsletter entry (row) will be created when a section (with a newsletter field) is saved. Once it is saved, you can start/pause/stop it. If you restart a newsletter, a new one is actually created.

You get the idea if you send newsletters from the Symphony backend and watch the database table change.

So the newsletter field is just a "remote control" for newsletters. You can do the same things with the API.

Something different: Google isn't a very good provider for what you're trying to achieve. Have you ever looked at Amazon SES, Sendgrid or Postmark?

They generally offer faster (and more reliable) delivery, and are very, very cheap. I am using SES for newsletters and Postmark for transactional emails, and I haven't had a single problem since I switched, while I was having lots of problems before.

Really recommended.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details