Google trends

Send email using mailgun API without library

Apr 14, 2019

Mailgun is good service provider which is allows you to send bulk emails via Mailgun API. Mailgun assembled a MIME message. In short, SMTP is an open and established protocol with large ecosystem, while Mailgun API is better long term performance and maintenance wise. Mailgun service is an Email automation service. Inbuilt functions for sending, tracking or receiving emails.

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_USERPWD, 'YOUR-API-KEY');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
  curl_setopt($ch, CURLOPT_URL, 
  curl_setopt($ch, CURLOPT_POSTFIELDS, 
                array('from' => 'Significant Techno <[email protected]>',
                      'to' => 'User Name <[email protected]>',
                      'subject' => 'Hello',
                      'text' => 'Testing some Mailgun awesomeness!'));
  $result = curl_exec($ch);
  return $result;

Copyright 2018. All rights are reserved