Documentation

Installation | JS

To get started with ekiliRelay, use npm to install and include it in your project.

  1. Install the mailer using npm:
  2. npm i ekilirelay
  3. Import the mailer into your project:
  4. import EkiliRelay from 'ekilirelay';
  5. Get you api key API KEY
Usage | JS/TS

After including the mailer, you can start using EkiliRelay to send emails. Here's a quick example for different frameworks and libraries:

Vanilla JavaScript
// Simple JS implementation
const sendBtn = document.getElementById("send"); // some button
import EkiliRelay from 'ekilirelay'; // importing EkiliRelay

// Initialize the mailer
const mailer = new EkiliRelay('your-api-key'); // your-api-key goes here

sendBtn.addEventListener("click", () => {
  // Send an email
  mailer.sendEmail(
    'receiver-email@example.com',
    'Test Subject',
    'This is a test message.',
    'From: senderName <sender-email@example.com>'
  )
  .then(response => {
    if (response.status === 'success') {
      console.log('Email sent successfully.');
    } else {
      console.log('Failed to send email: ' + response.message);
      console.log(response);
    }
  })
  .catch(error => {
    console.log('Error:', error);
  });
});
            
React.js
import React from 'react';
import EkiliRelay from 'ekilirelay';

const mailer = new EkiliRelay('your-api-key');

function App() {
  const sendEmail = () => {
    mailer.sendEmail(
      'receiver-email@example.com',
      'Test Subject',
      'This is a test message.',
      'From: senderName <sender-email@example.com>'
    )
    .then(response => {
      if (response.status === 'success') {
        console.log('Email sent successfully.');
      } else {
        console.log('Failed to send email: ' + response.message);
        console.log(response);
      }
    })
    .catch(error => {
      console.log('Error:', error);
    });
  };

  return (
    {/** Your ui **/}
  );
}

export default App;
            
Next.js
import EkiliRelay from 'ekilirelay';

export default function Home() {
  const mailer = new EkiliRelay(process.env.NEXT_PUBLIC_RELAY_API);

  const sendEmail = () => {
    mailer.sendEmail(
      'receiver-email@example.com',
      'Test Subject',
      'This is a test message.',
      'From: senderName <sender-email@example.com>'
    )
    .then(response => {
      if (response.status === 'success') {
        console.log('Email sent successfully.');
      } else {
        console.log('Failed to send email: ' + response.message);
        console.log(response);
      }
    })
    .catch(error => {
      console.log('Error:', error);
    });
  };

  return (
    {/** Your ui **/}
  );
}
            
PHP
// Class implementation
class EkiliRelay {
  private $apikey;
  private $apiUrl = "https://relay.ekilie.com/api/index.php";

  public function __construct($apikey) {
    $this->apikey = $apikey;
  }

  public function sendEmail($to, $subject, $message, $headers = '') {
    $data = [
      'to' => $to,
      'subject' => $subject,
      'message' => $message,
      'headers' => $headers,
      'apikey' => $this->apikey
    ];
    
    $ch = curl_init($this->apiUrl);
    curl_setopt_array($ch, [
      CURLOPT_POST => true,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
      CURLOPT_POSTFIELDS => json_encode($data)
    ]);
    
    $response = curl_exec($ch);
    return json_decode($response, true);
  }
}

// Usage
$mailer = new EkiliRelay('API_KEY');
$response = $mailer->sendEmail(
  'to@example.com', 
  'PHP Test', 
  'Hello from PHP!', 
  'From: PHP Sender '
);
Python
import requests

  def send_email(api_key, to, subject, message, headers=''):
      url = "https://relay.ekilie.com/api/index.php"
      payload = {
          "apikey": api_key,
          "to": to,
          "subject": subject,
          "message": message,
          "headers": headers
      }
      try:
          response = requests.post(url, json=payload)
          return response.json()
      except Exception as e:
          return {"status": "error", "message": str(e)}
  
  # Usage
  response = send_email(
      "API_KEY",
      "python@example.com",
      "Python Test",
      "Hello from Python!",
      "From: Python "
  )
  print(response)
cURL
curl -X POST "https://relay.ekilie.com/api/index.php" \
    -H "Content-Type: application/json" \
    -d '{
      "apikey": "API_KEY",
      "to": "curl@example.com",
      "subject": "cURL Test",
      "message": "Hello from command line!",
      "headers": "From: cURL User "
    }'
Vintlang

These examples demonstrate how to initialize the EkiliRelay mailer and send an email using various languages. The api also support html:xml message format

FAQ | JS/TS
How do I get started with ekiliRelay?

Simply download the mailer, include it in your project, and follow the usage instructions.

Is ekiliRelay really free?

Yes, ekiliRelay is completely free to use.

Can I customize the email template?

Yes, you can customize the email body as per your requirements using HTML and CSS.

Contact | JS

If you have any questions or need further assistance, please reach out to us: