以编程方式发送电子邮件

以编程方式发送电子邮件

本文介绍了以编程方式发送电子邮件,而不使用Blackberry设备中配置的EMAIL ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个社交应用程序,其中我需要将发送电子邮件作为请求发送给其他用户作为应用程序邀请。但是,我的要求是我不想使用设备中配置的电子邮件ID。



我想从支持发送电子邮件ID 。我不想使用用户的电子邮件ID。



这是可能吗?

解决方案

我认为这取决于你想做什么。在BlackBerry应用中发送电子邮件的简单方法是:

 消息m =新消息( ); 
地址a = new Address([email protected],Ming Li);
地址[] 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));

如果这是你想要做的,那么你会看到没有 FROM 字段在 MessageArguments 类中可用。因此,调用电子邮件应用程序将使用设备配置的电子邮件帐户,。


但是,除非我不了解BlackBerry网络基础设施的一些内容(比如他们有过滤功能会阻止这种情况),我不明白为什么你不能写出自己的小型电子邮件客户端连接到目标服务器,并发送消息与您喜欢的任何电子邮件头。一个简单的J2ME 客户端可能会显示。 (注意:我没有尝试过该代码,但乍一看,它看起来像是正确的方法)。当然,它比我上面发布的代码更多的代码!



我们现有的许多电子邮件基础架构中的一大问题是发件人的地址不是验证。所以你可以说。这就是为什么垃圾邮件和是一个很大的问题。任何人谁可以向您发送一封声称来自您的银行的电子邮件,或其他不属于您的银行。



现在,我不会写垃圾邮件过滤器,并且每个目的地邮件服务器可以使用不同的算法。根据您使用的 FROM 地址,以及如何将邮件路由到其SMTP服务器(您使用的BlackBerry传输),您的用户可能会发现垃圾邮件过滤器捕获电子邮件。



所以,这可能不适用于你。无论如何,我只想展示如何在J2ME应用程序中完成,您可能需要在一个真正的IT论坛上发布这个问题的一部分内容,看看有什么人可以说垃圾邮件过滤器问题。




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?

解决方案

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("[email protected]", "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

这篇关于以编程方式发送电子邮件,而不使用Blackberry设备中配置的EMAIL ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:59