send email programmatically without using EMAIL ID

2019-08-09 00:54发布

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?

2条回答
霸刀☆藐视天下
2楼-- · 2019-08-09 01:31

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.

查看更多
倾城 Initia
3楼-- · 2019-08-09 01:33

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

查看更多
登录 后发表回答