Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. function send_message($from, $recipient, $subject, $email_content)
  2. {
  3. $ch = curl_init();
  4. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  5. curl_setopt($ch, CURLOPT_USERPWD, 'api:key-f2524e3723fd79b88580971f1bcf9a46');
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
  8. curl_setopt($ch, CURLOPT_URL,
  9. 'https://api.mailgun.net/v3/mg.mobilerocket.co.uk/messages');
  10. curl_setopt($ch, CURLOPT_POSTFIELDS,
  11. array('from' => $from,
  12. 'to' => $recipient,
  13. 'subject' => $subject,
  14. 'text' => $email_content
  15. ));
  16. $result = curl_exec($ch);
  17. curl_close($ch);
  18.  
  19. return $result;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement