01-27-2010 11:54 AM
I want to send an email from my device which is provissioned on an email address "firstname.lastname@example.org". But I want to send an email which on sending, its recipient should see that the email has came from "email@example.com". I was tring the following code, but it doesn't work and the recipient sees that same email address using which the email was sent:
SGN @ XYZ.COM
String to = "firstname.lastname@example.org";
String subject = "Email from someone Else";
String body = "This email's From is different from the sender's actual email";
String senderEmail= "email@example.com";
Store store = Session.waitForDefaultSession().getStore();
Folder folders = store.list(Folder.SENT);
Folder sent = folders;
Message message = new Message(sent);
Address fromAdd = new Address(senderEmail, senderEmail);
Address toAdd = new Address(to, to);
Address toAdds = new Address;
toAdds = toAdd;
catch (Throwable e)
Log.error("Could not create/send email message.", e);
But what happens is, upon receiving the email, firstname.lastname@example.org observe that the email was sent by email@example.com and not from firstname.lastname@example.org.
Any one knows, how to achieve this ?
02-01-2010 11:28 AM
The from address is populated based on the email account you are sending the message from (you can have multiple email accounts on a single BlackBerry smartphone).
If the from address you wish to use is for one of these accounts, you can make this change.
Instead of opening the default session you'd need to use the ServiceBook class to locate the service record for the email address you wish to use. You can find an example of this here:
How To – Send a message from a non-default email address
Article Number: DB-00561
02-02-2010 02:20 AM - edited 02-02-2010 02:28 AM
I was trying to set the FROM field to an email address which is not setup on the device. Reading your response, it appears that this is not possible.
02-02-2010 02:54 AM
You could write your own SMTP delivery mechanism that mangles the headers as you wish. This is far more difficult to achieve, however, and has obviously no immediate integration with the Blackberry messaging system already existing on the device.