dpbsy60000 2014-11-06 14:30
浏览 73

使用Mailgun发送字符串附件

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.

  • 写回答

1条回答 默认 最新

  • dongshendi3599 2016-02-03 13:05
    关注
    $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/

    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题