Is it possible to send an attachment as a string using Mailgun - i.e. similar to the way this can be done in PHPMailer, using AddStringAttachment()
.
The Mailgun documentation seems to only relate to attaching files. I found this article, but I'm not sure what language the code is written in and don't understand how I could adapt to php.
$mg = new Mailgun('mailgun-api-key');
$msg = $mg->MessageBuilder();
$msg->setFromAddress($from);
$msg->setSubject($subject);
$msg->setTextBody($textBody);
$files['attachment'] = array();
$files['attachment'][] = '/var/www/somefile.php';
$mg->post("{$domain}/messages", $msg->getMessage(), $files);
See this link: https://pmellor.wordpress.com/2013/12/11/adding-attachments-to-email-using-the-mailgun-com-php-api/