VB 2010
Hi,
I have a application at work that users use to help fill in templates, it then populates outlook with all relevant information to send.
My works is currently moving over to Outlook 365, so the users only have access to the web based outlook 365 logging in via a portal.
I have tested the following code on my PC and it does work ok, but the users use thin clients on Citrix, and the program just hangs when try to send email, it doesn't seem to timeout or even error out, just hangs, I then have to use the Citrix client to terminate the process.
I am hopeing you guys can throw some light on this.
Hi,
I have a application at work that users use to help fill in templates, it then populates outlook with all relevant information to send.
My works is currently moving over to Outlook 365, so the users only have access to the web based outlook 365 logging in via a portal.
I have tested the following code on my PC and it does work ok, but the users use thin clients on Citrix, and the program just hangs when try to send email, it doesn't seem to timeout or even error out, just hangs, I then have to use the Citrix client to terminate the process.
I am hopeing you guys can throw some light on this.
VB.NET:
Imports System.Net.Mail
Public Sub SendEmailOutlook365(sSubject As String, sBody As String, _
sTo As String, sCC As String, _
sFilename As String, _
sFrom As String, sPassword As String)
Try
Dim Smtp_Server As New SmtpClient
Dim e_mail As New MailMessage()
Smtp_Server.UseDefaultCredentials = False
' I have tried both of these and they work on my PC but I am outside the citrix platform
'Smtp_Server.Credentials = New Net.NetworkCredential(sFrom, sPassword, "mydomain.com")
Smtp_Server.Credentials = New Net.NetworkCredential(sFrom, sPassword)
Smtp_Server.Port = 587
Smtp_Server.EnableSsl = True
Smtp_Server.Host = "smtp.office365.com"
Smtp_Server.Timeout = 10000
e_mail = New MailMessage()
e_mail.From = New MailAddress(sFrom)
e_mail.To.Add(sTo)
e_mail.To.Add(sFrom)
e_mail.Subject = sSubject
e_mail.IsBodyHtml = False
e_mail.Body = sBody
Smtp_Server.Send(e_mail)
MsgBox("Mail Sent")
Catch error_t As Exception
MsgBox(error_t.ToString)
End Try
End Sub