我可以发送带有图形图像(* .jpg)的彩信,并在我的Android手机上查看。但是,当我尝试PDF时,PDF文件不显示我的手机。我发送到iPhone,但接收短信应用程序说它无法处理传入的PDF。 我是NodeJS样本,有一个属性:'mediaContentType:“pdf”'。我在Java中没有注意到它。 How to Send Pdf as MMS by Twilo Using Nodejs?
package twilio;
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
import java.net.URI;
import java.net.URISyntaxException;
public class SendMsgMMS {
public static final String ACCOUNT_SID = "<my Twilio SID>";
public static final String AUTH_TOKEN = "<my Twilio Auth code>";
public static void main(String[] args) throws URISyntaxException {
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
String fromPhoneNumber = "+11231231234";
String toPhoneNumber = "+15551231234";
Message message = Message.creator(
new PhoneNumber(toPhoneNumber),
new PhoneNumber(fromPhoneNumber),
"Sample PDF"
)
.setMediaUrl(new URI("http://tigerfarmpress.com/books/download/HyperCubes02vSa.pdf"))
.create();
System.out.print("+ from:" + message.getFrom());
System.out.print(", to:" + toPhoneNumber);
System.out.print(", " + message.getSid());
System.out.print(", " + message.getBody());
System.out.println("");
}
}