I would like to use Swift Mailer.

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 10, 2015   (RSS)

By Dave - July 10, 2015

Hi Ron,

Our internal function is called sendMessage() and can be found in /lib/common.php.

Here's some examples from the function header:

// send an email message with attachments.
// If text _and_ html are specified the email client will decide what to display.
/*
  // Minimal Example:
  $errors = sendMessage(array(
    'from'    => "from@example.com",
    'to'      => "to@example.com",
    'subject' => "Enter subject here, supports utf-8 content",
    'text'    => "Text message content",
  ));
  if ($errors) { die($errors); }

  // Full Featured Example:
  $errors = sendMessage(array(
    'from'    => "from@example.com",
    'to'      => "to@example.com",
    'subject' => "Enter subject here, supports utf-8 content",
    'text'    => "Text message content",
    'html'    => "<b>HTML</b> message content",
    'headers' => array(
      "CC"          => "cc@example.com",
      "BCC"         => "bcc@example.com",
      "Reply-To"    => "rt@example.com",
      "Return-Path" => "rp@example.com",
    ),
    'attachments' => array(
      'simple.txt'  => 'A simple text file',
      'dynamic.csv' => $csvData,
      'archive.zip' => $binaryData,
      'image.jpg'   => file_get_contents($imagePath),
    ),
    //'disabled' => false, // set to true to disable sending of message
    //'logging' => false, // set to false to disable logging (if logging is already enabled) - used for background mailers
  ));
  if ($errors) { die($errors); }

Hope that helps!  Let me know any questions.

Dave Edis - Senior Developer
interactivetools.com

By Dave - July 10, 2015

And something else you might find helpful.  Go to: Admin > Email Templates and select "Developers: Show sendMessage() PHP".  If you create an email template in that section it will generate the sendMessage() code for you.

Dave Edis - Senior Developer
interactivetools.com

By rconring - July 10, 2015

Thanks Dave for your prompt reply! 

This looks very promising!

Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987