Good afternoon all!
I'm having trouble here, and I've visited about half the sites on the internet to fix it, and I'm not having luck.
I'm trying to write a VB.NET application that will monitor an exchange server mailbox and download any attachments in received messages. However, I cannot find a way to connect to the server.
This is what I have to far:
I know that within outlook, the mailbox requires password authentication, so I tried to add a crediential before sending, however the "server.Send(ms g)" line generates the following error:
If anyone has any suggestions, I'd love to listen! I've only messed with Outlook and COM functions, and I haven't done anything like this, so I'm not even sure where to start.
Thanks!
I'm having trouble here, and I've visited about half the sites on the internet to fix it, and I'm not having luck.
I'm trying to write a VB.NET application that will monitor an exchange server mailbox and download any attachments in received messages. However, I cannot find a way to connect to the server.
This is what I have to far:
Code:
Dim server As New System.Net.Mail.SmtpClient("STHEMB002", 25)
Dim msg As New System.Net.Mail.MailMessage()
msg.To.Add("Bob.Dole@company.com")
msg.From = New System.Net.Mail.MailAddress("Bob.Dole@company.com")
msg.Subject = "test"
server.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
server.UseDefaultCredentials = False
server.Credentials = New System.Net.NetworkCredential("user", "pass", "STHEMB002")
server.Send(msg)
Code:
System.Net.Mail.SmtpException was unhandled
Message="Failure sending mail."
Source="System"
StackTrace:
at System.Net.Mail.SmtpClient.Send(MailMessage message)
Thanks!
Comment