dongtou8736 2015-02-25 18:48
浏览 21

接收mms到电子邮件(照片作为附件)

it appears this is the place to post questions. I have written the support help desk to no avail.

What I am interested in is recieving photos with my Twilio MMS number where they route to my email.

Now, I installed the PHP and the Text portion routes fine however it is not sending the images.

You have received a message from +17041234567.Body: MediaUr1: Is not set

below is the coding and I admit I am a severe novice to php. If anyone can tell me exactly how this script should appear maybe where I can copy and paste replacing the xxxxxxxx with my actual email address.. it would be a big help in finalizing this.

Thank You in advance


<?php
/**
 * This section ensures that Twilio gets a response.
 */
header('Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml;');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response>received</Response>'; //Place the desired response (if any) here

/**
 * This section actually sends the email.
 */
$to      = "support@xxxxxxxx.com"; // Your email address
$subject = "Message from {$_REQUEST['From']} at {$_REQUEST['To']}";
$message = "You have received a message from {$_REQUEST['From']}.Body: {$_REQUEST['Body']}";
if (isset($_REQUEST['1'])) $message .= " MediaUrl: {$_REQUEST['MediaUr1']}";
else $message .= " MediaUr1: Is not set";
$headers = "From: support@xxxxxxxx.com"; // Who should it come from?
mail($to, $subject, $message, $headers);
  • 写回答

1条回答 默认 最新

  • dsjk3214 2015-02-26 13:16
    关注

    Twilio evangelist here.

    Not sure if this is a typo in your code snippet or not, but it looks like you are trying to request the parameter MediaUr1. Notice the last character is the number 1.

    If thats not a typo, then the correct parameter should be MediaUrl{N}, where {N} is replaced by the number, in your case 1:

    if (isset($_REQUEST['MediaUrl1'])) $message .= " MediaUrl {$_REQUEST['MediaUrl1']}";
    else $message .= " MediaUrl1: Is not set";
    

    Hope that helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?