0

is there any way to send an email template using the sendwithus service? I searched a lot but nothing found.

The documentation is poor.

Any code example? I am using PHP

Karl Horky
  • 4,410
  • 2
  • 31
  • 35
EnexoOnoma
  • 8,454
  • 18
  • 94
  • 179

2 Answers2

2

You can find the SendWithUs templating documentation here: https://www.sendwithus.com/docs/templating. It explains both the API calls and the formatting you need to use to replace aspects of your templates, which you store inside SendWithUs.

However, you're using PHP and they've created a library just for you to use that also helps with the templating side of things.

Martyn Davies
  • 1,493
  • 9
  • 12
  • Thank you for the links, I already looked at them both. The problem is that I can not find a single stand alone example to start editing and building on it. These things were supposed to be as friendly as possible... – EnexoOnoma Mar 26 '15 at 14:15
  • If you post the code you currently have then it would be better, you can at least get that from the examples and their github. – Martyn Davies Mar 26 '15 at 14:59
  • 1
    @Xalloumokkelos Martyn has exactly the right idea with this answer. If you're still having trouble, don't hesitate to post your code or reach out to sendwithus support -- they'd be happy to help you out. – bvanvugt Mar 30 '15 at 23:42
0

Here a simple class to send emails with sendwithus:

<?php    

use sendwithus\API;   

require_once 'vendor/autoload.php';


class Sendwithus {

    const TEST_API_KEY = 'test_api_key_here';

    //three examples in the web...just for testing...
    const SENDWITHUS_BALLON_PARTY = 'tem_id_1';
    const SENDWITHUS_HAPPY_EMAIL = 'tem_id_2';
    const SENDWITHUS_ROBOT_WELCOME = 'tem_id_3';

    private $api;

    public function __construct(){
        $options = array(
            'DEBUG' => true
        );

        //login into Sendwithus with API key...
        $this->api = new API(self::LIVE_API_KEY, $options);
    }

    public function send($template_id){
        $this->api->send(
            $template_id,
            array('address' => 'foo@email.com')
        );
    }

}

//send email...
$sendwithus = new Sendwithus();
$sendwithus->send($sendwithus::SENDWITHUS_BALLON_PARTY);

Hope this can help you

Regards,

Roger

Roger Guasch
  • 412
  • 5
  • 19