how to connect visual basic .net with microsoft exchange with free libraries posible?

情到浓时终转凉″ 提交于 2019-12-22 18:25:20

问题


Are there any free libraries for VB.net to use for connecting to a MS exchange server? I have found some paid ones but I'd rather not invest, so couln't find any free libraries.. I tried using java as a protocol layer for mapi but it wouldn't work


回答1:


What are you trying to accomplish?

I've had no trouble sending mail via my Exchange account using the regular SMTP client

    Public Shared Sub SendEmail(ByVal sFromAddress As String, _
                            ByVal sToAddress As String, _
                            ByVal sSMTPAddress As String, _
                            ByVal sUsername As String, _
                            ByVal sPassword As String, _
                            ByVal sOrderNo As String, _
                            ByVal sURL As String, _
                            ByVal iPort As Integer)

    Try
        Dim client As New SmtpClient(sSMTPAddress, iPort)
        client.UseDefaultCredentials = False
        client.Credentials = New System.Net.NetworkCredential(sUsername, sPassword)
        client.EnableSsl = True

        Dim mail As New MailMessage
        mail.To.Add(sToAddress)
        mail.From = New MailAddress(sFromAddress)
        mail.Subject = GetSubject(sOrderNo)
        mail.IsBodyHtml = True
        mail.Body = GetBody(sOrderNo, sURL)

        client.Send(mail)

    Catch ex As Exception
        MessageBox.Show("Error Sending E-mail!")
    End Try

End Sub

If you want to have a more meaningful interaction, I know you can accomplish a lot by using Microsoft.Office.Interop.Outlook. Check out http://msdn.microsoft.com/en-us/library/ms268893(VS.80).aspx for some more information.




回答2:


Introducing the Exchange Web Services Managed API 1.0

http://msdn.microsoft.com/en-us/library/dd633678(EXCHG.80).aspx



来源:https://stackoverflow.com/questions/5175926/how-to-connect-visual-basic-net-with-microsoft-exchange-with-free-libraries-pos

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