接收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);

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.