Giriş yap

API ve kitaplık

Kendi sitenizden ya da uygulamanızdan e-posta ve doğrulama kodu gönderin. İstekler sunucunuzdan yapılır; anahtarı tarayıcıya ya da mobil uygulamaya koymayın.

1. Anahtar alın

Webmailde Hesap > API bölümünden bir anahtar oluşturun ve gönderen adresi seçin. Anahtar yalnızca bir kez gösterilir. Gönderen adresin alan adı doğrulanmış olmalıdır.

2. Kitaplığı ekleyin

yoyomail.js (Node 18+, Deno, Bun) · YoyoMail.php (PHP 7.4+)

3. Doğrulama kodu gönderin

JavaScript

import { YoyoMail } from './yoyomail.js';
const mail = new YoyoMail(process.env.YOYOMAIL_KEY, { baseUrl: 'https://mail.yoyohq.net' });

// Kayıt ya da giriş sırasında
const { id } = await mail.sendCode('musteri@example.com', { brand: 'Acme', lang: 'tr' });
// id değerini oturumda saklayın; kullanıcı kodu yazınca
const { valid, reason } = await mail.checkCode(id, '123456');

PHP

require 'YoyoMail.php';
$mail = new YoyoMail(getenv('YOYOMAIL_KEY'), 'https://mail.yoyohq.net');

$r = $mail->sendCode('musteri@example.com', ['brand' => 'Acme']);
$_SESSION['code_id'] = $r['id'];
// ...
$ok = $mail->checkCode($_SESSION['code_id'], $_POST['code'])['valid'];

curl

curl https://mail.yoyohq.net/api/v1/verify/send \
  -H "Authorization: Bearer ym_..." -H "Content-Type: application/json" \
  -d '{"to":"musteri@example.com","brand":"Acme"}'

curl https://mail.yoyohq.net/api/v1/verify/check \
  -H "Authorization: Bearer ym_..." -H "Content-Type: application/json" \
  -d '{"id":"vc_...","code":"123456"}'

4. Kendi iletinizi gönderin

await mail.send({
  to: 'musteri@example.com',
  subject: 'Siparişiniz yola çıktı',
  text: 'Kargo takip numaranız: 123',
  html: '<p>Kargo takip numaranız: <b>123</b></p>',
  fromName: 'Acme',
});

Uçlar

Hepsi Authorization: Bearer ym_... başlığı ister; gövde ve yanıt JSON'dur.

POST /api/v1/verify/sendto, brand, lang (tr|en), digits (4-8), ttl (saniye, 60-3600) → { id, to, expiresAt }
POST /api/v1/verify/checkid, code → { valid, reason, attemptsLeft }
POST /api/v1/sendto, subject, text, html, cc, bcc, fromName → { id, delivered, queued, rejected }
GET /api/v1/me→ { from, account, plan, sentToday, dailyLimit }

Kurallar ve sınırlar