Send email using mailgun API without library

Apr 14, 2019 / PHP /

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 <>',
                      'to' => 'User Name <>',
                      'subject' => 'Hello',
                      'text' => 'Testing some Mailgun awesomeness!'));
  $result = curl_exec($ch);
  return $result;


Mohammad ( Apr 15, 2019 09:12:41 )

Thank you

Would you like to share your thoughts?

Your email address will not be published. Required field are marked*

Copyright 2018. All rights are reserved Significant Techno Web Design & Web Development By Significant Techno