title: SmsManager with Email Address as Destination - NullPointerException
body: <p>My cellphone carrier offers an sms-email gateway. This is done simply by entering the email address as the SMS message's destination. The email is delivered as 5555555555@mycarrier.com</p>
  
  <p>I am attempting to use this with my new Android device. The standard android messaging application converts all messages with an email address as the destination to "MMS" and attempts to send them as data - not what I want to do.</p>
  
  <p>Attempting with <code>android.telephony.SmsManager</code>:</p>
  
  <pre><code>SmsManager manager = SmsManager.getDefault();
  
  manager.sendTextMessage("address@example.com", null, "Message body here", null, null);
  </code></pre>
  
  <p>This throws the following exception:</p>
  
  <pre><code>Caused by: java.lang.NullPointerException
      at com.android.internal.telephony.gsm.SmsMessage.getSubmitPduHead(SmsMessage.java:595)
      at com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(SmsMessage.java:295)
      at android.telephony.SmsMessage.getSubmitPdu(SmsMessage.java:599)
      at android.telephony.SmsManager.sendTextMessage(SmsManager.java:228)
      at android.telephony.SmsManager.sendTextMessage(SmsManager.java:107)
  </code></pre>
  
  <p>I've looked at this project, <a href="http://code.google.com/p/android-sms-email/" rel="nofollow">android-sms-email</a>, which attempts to do the same thing. It also crashes in the same fashion when configured for my carrier.</p>
  
  <p>This does not seem like the desired behaviour and I assume it is an Android bug (some bug reports hint at the issue). I've experimented a bit and can see that appending any number and some symbols to the email address do not cause the same failure but the message is not delivered either. </p>
  
  <p>I've also tried using <code>SmsManager.sendMultipartTextMessage</code> but this runs into the same problem within <code>SmsMessage.getSubmitPduHead</code>.</p>
  
  <p>Again:</p>
  
  <pre><code>SmsManager manager = SmsManager.getDefault();
  
  // Works
  manager.sendTextMessage("15555555555", null, "Message body here", null, null);
  
  // Fails
  manager.sendTextMessage("address@example.com", null, "Message body here", null, null);
  </code></pre>
  
  <p>Tested on an HTC Desire Z - Android v2.2</p>