简体   繁体   English

我需要从Microsoft Exchange服务器上托管的电子邮件发送电子邮件

[英]I need to send emails from an email hosted on a Microsoft Exchange server

I successfully created a java program that can send emails from a gmail account, however, now I need to do the same with an email account using a Microsoft Exchange Server. 我成功创建了一个Java程序,该程序可以从gmail帐户发送电子邮件,但是,现在我需要使用Microsoft Exchange Server对电子邮件帐户执行相同的操作。

The difference is when I was creating the gmail application I had all the information I needed to just plug into the JavaMail API program to make it work. 区别在于,当我创建gmail应用程序时,我拥有将其插入JavaMail API程序以使其正常运行所需的所有信息。 For example, the SMTP server is smtp.gmail.com, the port is 587, the account needs to be set to "Less secure login requirements", etc... 例如,SMTP服务器是smtp.gmail.com,端口是587,需要将帐户设置为“较少安全登录要求”,等等。

I do not have access to any of this information for the Exchange Server. 我无权访问Exchange Server的所有信息。 I am wondering if this is possible to do? 我想知道是否可以这样做? I would assume I probably wont be able to use the JavaMail API like I did with gmail seeing as i don't have any of the information that is required for the fields. 我认为我可能无法像使用gmail一样使用JavaMail API,因为我没有该字段所需的任何信息。 Is there some other library out there that I can use? 还有其他我可以使用的图书馆吗?

If some of this sounds like I don't really know what I'm talking about it's probably because I don't. 如果其中某些听起来像我真的不知道我在说什么,那可能是因为我不知道。 This is kind of new territory for me, and I seem to have hit a wall. 对我来说,这是一个新领域,我似乎已经碰壁了。 Basically I just need a program that can send an email from an account hosted on a Microsoft Exchange server. 基本上,我只需要一个可以从Microsoft Exchange服务器上托管的帐户发送电子邮件的程序。 Hopefully this make since. 希望此后。 Thanks. 谢谢。

Ms Exchange and GMail are both email providers, they rely on the same protocol : SMTP . Exchange女士和GMail都是电子邮件提供商,它们依赖于相同的协议: SMTP So your JavaMail API should also work with Exchange, provided the required features are enabled : 因此,只要启用了必需的功能,您的JavaMail API也应该可以与Exchange一起使用:

  1. SMTP : should be enabled by default, unless your admin disabled it. SMTP:默认情况下应启用,除非您的管理员禁用了它。
  2. SMTP Authentication , or SMTP relay for your sender IP address : Some authentication mechanisms (AUTH LOGIN) are disabled by default on latest versions of Exchange. SMTP身份验证 ,或发送方IP地址的SMTP中继 :默认情况下,在最新版本的Exchange上,某些身份验证机制(AUTH LOGIN)被禁用。 Relay also has to be configured by the admin. 中继也必须由管理员配置。

The easiest way to find out your exchange server address and port is to contact your Exchange administrator. 找出您的Exchange服务器地址和端口的最简单方法是与您的Exchange管理员联系。 However, you can find it by yourself by : 但是,您可以通过以下方式自己找到它:

  1. If you're not on the exchange local network, you can try "nslookup -q=mx senderdomain.com" to find out the Exchange IP adderss 如果您不在Exchange本地网络上,则可以尝试“ nslookup -q = mx senderdomain.com”来查找Exchange IP加法器
  2. Else, you can try and follow this procedure 否则,您可以尝试执行以下步骤

Once you have the Exchange IP address, confirm that SMTP delivery port (25) is opened, it should be. 获得Exchange IP地址后,请确认SMTP交付端口(25)已打开。 If relay is authorized for your IP, you should be done. 如果中继被授权用于您的IP,则应该完成。 Else, test if SMTP submission port (587) is opened, that should be the one you use to send authenticated emails. 否则,测试是否打开了SMTP提交端口(587),该端口应该是用于发送经过身份验证的电子邮件的端口。

Alternatively, you can try and use Exchange Web Services API, provided it's enabled on the server. 或者,您可以尝试并使用Exchange Web Services API(如果已在服务器上启用该API)。 There seems to be a Microsoft JAVA libray to use EWS : ews-java-api . 似乎有一个Microsoft JAVA图书馆使用EWS: ews-java-api

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM