API उदाहरण (संलग्नक सहित)
अटैचमेंट के साथ POST अनुरोध (अधिकतम 5: attach1, attach2, …)
PHP के साथ CURL-रहित विधि
<?php
require_once 'HTTP/Request2.php';
$config = array('use_brackets' => false,
);
$request = new HTTP_Request2('https://rsXXX-api.realsender.com/mail/send',
HTTP_Request2::METHOD_POST,
$config);
$data = array('apiuser' => 'the one we provided you',
'apipass' => 'the one we provided you',
'from' => 'sender@example.com',
'to' => 'recipient@example.com',
'subject' => 'subject of the message',
'text' => 'email body in plain text',
'html' => 'email body in HTML format');
foreach ($data as $k => $d) {
$request->addPostParameter($k, $d);
};
$request->addUpload('attach1', './sample.pdf', 'sample.pdf', 'application/pdf');
$request->addUpload('attach2', './sample.txt', 'sample.txt', 'text/plain');
$result = $request->send();
var_dump($result);
?>संलग्नकों के साथ POST अनुरोध
CURL विधि
curl -F 'apiuser=वह जो हमने आपको प्रदान किया है' \ -F 'apipass=वह जो हमने आपको प्रदान किया है' \ -F 'from=sender@example.com' \ -F 'to=recipient@example.com' \ -F 'subject=संदेश का विषय' \ -F 'text=साधारण पाठ में ईमेल बॉडी' \ -F 'html=HTML प्रारूप में ईमेल बॉडी' \ -F 'attach=@sample.pdf;type=application/pdf' \ -F 'attach=@sample.txt;type=text/plain' \ https://rsXXX-api.realsender.com/mail/send