send email programmatically without using EMAIL ID configured in Blackberry device?

匆匆过客 提交于 2019-12-14 04:20:50

问题


I am developing a Social Application in which I need to send email as a request to other users as an Application Invitation. However, my requirement is that I don't want to use the E-mail ID configured in the device.

I want to send the Email from the support ID of my firm. I do not want to use the USER'S Email ID.

Is this possible?


回答1:


I very much doubt that would be possible from the device. If it were then any application could spoof mail from any email address. This would not be a good thing.

Your application could, for example, send the information needed to compose the email to your company server which would then send the mail out.

Another option would be to integrate your application with BlackBerry Messenger. Invitation to download your application would then take very little effort on your part and not require use of your company servers at all.




回答2:


I think it depends on what you want to do. An easy way to send emails in a BlackBerry app is to do something like this:

Message m = new Message();
Address a = new Address("mLi@rim.com", "Ming Li");
Address[] addresses = {a};
m.addRecipients(net.rim.blackberry.api.mail.Message.RecipientType.TO, addresses);
m.setContent("A message for you...");
m.setSubject("Email for you");
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));

If that's what you want to do, then you'll see from the API docs that there is no FROM field available in the MessageArguments class. So, invoking the email application will use the device's configured email account, as Richard suggested.

But, unless I don't know something about the BlackBerry network infrastructure (like they have filtering that would stop this), I don't see why you couldn't write your own small email client, to connect to the destination server, and send the message with whatever email headers you like. A simple J2ME SMTP client might look like this sample code. (Note: I haven't tried that code, but at first glance, it looks like the right approach). Of course, it's certainly more code than the snippet I posted above!

One of the big problems with much of our existing email infrastructure is that the sender's address isn't authenticated. So you can say that the email is from whoever you want. This is one reason why spam and phishing are such big problems. Anyone who wants to can send you an email that claims to be from your bank, or someone else that they're not.

Now, I don't write spam filters, and every destination mail server can be using a different algorithm. It's possible that your users will find their spam filters trapping your emails, depending on what FROM address you use, and how you route the message to their SMTP server (which BlackBerry transport you use).

So, this might not work well for you. Anyway, I just wanted to show how it could be done in a J2ME app ... you may need to post part of this question on a true IT forum, and see what people have to say about the spam filter issue.

Here's a discussion on the topic



来源:https://stackoverflow.com/questions/14236116/send-email-programmatically-without-using-email-id-configured-in-blackberry-devi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!